argh Python metaclasses
public text v1 · immutableclass Foo(type):
def __init__(cls, name, bases, dct): print 'class defined!'
class Bar:
__metaclass__ = Foo
def __init__(self):
self.attribute = 42
def foo(self):
print "I'm a method!"
b = Bar()
print b.attribute
b.foo()