Alex Martelli <[EMAIL PROTECTED]> writes: > On 2005 Feb 20, at 04:35, Jack Diederich wrote: > >> I didn't dig into the C but does having 'type' >> as metaclass guarantee the same behavior as inheriting 'object' or >> does object >> provide something type doesn't? *wince* > > I believe the former holds, since for example:
I was going to say that 'type(object) is type' is everything you need to know, but you also need the bit of code in type_new that replaces an empty bases tuple with (object,) -- but class C: __metaclass__ = Type and class C(object): pass produce identical classes. > This is because types.ClassType turns somersaults to enable this: in > this latter construct, Python's mechanisms determine ClassType as the > metaclass (it's the metaclass of the first base class), but then > ClassType in turn sniffs around for another metaclass to delegate to, > among the supplied bases, and having found one washes its hands of the > whole business;-). It's also notable that type_new does exactly the same thing! Cheers, mwh -- <etrepum> Jokes around here tend to get followed by implementations. -- from Twisted.Quotes _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com