Should Python documentation for __class__ be improved?

Stefan Franke spamfranke at
Wed Mar 15 02:38:03 CET 2000

On Tue, 14 Mar 2000 18:28:51 -0500, Tom Funk
<_spam_sux_tdfunk at> wrote:

>  o  when called it creates a new instance of the class  
>     i.e., 
>         c=Class(arg,...) 
>      is the same as 
>         c=self.__class__(arg,...)
>(Pretty cool stuff, Guido! :-)

Hmm, is this case, yes, but not generally: 


creates an instance of self's class even in derived classes,
(descendants of 'Class') whereas 


creates only instances of 'Class' itself. This trick makes Guido's
implementation even a bit cooler than you'd figured out by now..

>So, what __class__ *really* is, is: 

a reference to a *class object*, which is a first order object like
integers, strings and functions too. That means they can be assigned
or passed as parameters/return values or computed by an expression
like any other value in Python.


More information about the Python-list mailing list