getting a reference to a class inside its definition

Pearu Peterson pearu at cens.ioc.ee
Mon Jun 18 14:42:58 EDT 2001


On Mon, 18 Jun 2001, dan wrote:

> class SomeClass: 
>     pass
> SomeClass.clsref = SomeClass

If it will be used as

>>> SomeClass().clsref

then it is equivalent to

>>> SomeClass().__class__

So, why would you want .clsref attribute if .__class__ is
available already?

Pearu




More information about the Python-list mailing list