After reading a great SO post , I tried to create a level-level metaclass:
def metaclass(future_class_name, future_class_parents, future_class_attrs): print "module.__metaclass__" future_class_attrs["bar"]="bar" return type(future_class_name, future_class_parents, future_class_attrs) __metaclass__=metaclass class Foo(object): def __init__(self): print 'Foo.__init__' f=Foo()
This does not work (i.e., "module. Metaclass " does not print) unless I remove the base class object
Foo. Why?
NOTE. I am using Python 2.6.1.
source share