Alan Isaac <[EMAIL PROTECTED]> writes: > This thread raises two questions for me. > > 1. I take it from this thread that in Python 3 the following are > equivalent: > > class Test: pass > > class Test(object): pass > > Is that correct, and if so, where is it stated explicitly? > (I know about the "all classes are new style classes" statement.)
I don't know where it is stated, but how could they *not* be equivalent? > 2. I take it from this thread that in Python 2.2+ if I put the > following at the top of a module :: > > __metaclass__ = type > > then all the classes defined in that module will be newstyle > classes. Is that correct? Somehow I did not grok that from > > <URL:http://docs.python.org/ref/metaclasses.html> > > but it seems right. >From the URL you quote: The appropriate metaclass is determined by the following precedence rules: * If dict['__metaclass__'] exists, it is used. * Otherwise, if there is at least one base class, its metaclass is used (this looks for a __class__ attribute first and if not found, uses its type). * Otherwise, if a global variable named __metaclass__ exists, it is used. * Otherwise, the old-style, classic metaclass (types.ClassType) is used. Look at the third point. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list