mirror of
https://github.com/bendtherules/pytry.git
synced 2026-08-18 13:53:01 +00:00
All the previous files
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
class C():
|
||||
|
||||
class mclass(type):
|
||||
def __new__(mcs, name, bases, attributes):
|
||||
# Do something clever with name, base or attributes
|
||||
name="so_cool "+name
|
||||
cls = type.__new__(mcs, name, bases, attributes)
|
||||
# Do something cleverer with the class itself
|
||||
print ("I've created class whose","name: ",name," mcs: ",mcs," bases: ",bases," attributes: ",attributes)
|
||||
return cls
|
||||
|
||||
class A(object):
|
||||
"Customizing the creation of class A"
|
||||
__metaclass__=C.mclass
|
||||
|
||||
class B(A):
|
||||
static = 1
|
||||
Reference in New Issue
Block a user