Metaclasses and new-style classes

jepler at jepler at
Mon Aug 8 02:07:50 CEST 2005

This may be a limitation Zope imposes.

I wrote this program:
class M(type):
	def __new__(*args):
		print "new M", args

class T(object):
	__metaclass__ = M

Running it prints
new M (<class '__main__.M'>, 'T', (<type 'object'>,),
	{'__module__': '__main__', '__metaclass__': <class '__main__.M'>})
... so you can see that the __metaclass__ mechanism works just fine with
new-style objects in plain Python.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list