>>> __metaclass__ = whatever >>> >>> at the top of each module whose classes are to get the new behavior. >> >> I think '__metaclass__ = whatever' affects only the creation of classes >> that would otherwise be old-style classes? > > Wrong. > > If you set __metaclass__ = type, every class in that module will be > new-style.
>>> from UserDict import UserDict >>> type(UserDict) <type 'classobj'> >>> class A(UserDict): ... pass >>> type(A) <type 'classobj'> >>> __metaclass__ = type >>> class B(UserDict): ... pass >>> type(B) <type 'classobj'> It seems that NOT every class in my module will be a new style class, especially those that inherit from other old-style classes in other modules. -- damjan -- http://mail.python.org/mailman/listinfo/python-list