should I put old or new style classes in my book?

Alan Isaac aisaac at american.edu
Thu May 29 16:26:15 EDT 2008


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.)



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.



Thank you,

Alan Isaac







More information about the Python-list mailing list