Reference class in class creation

Gregor Horvath gh at
Tue Nov 21 13:52:29 CET 2006

Diez B. Roggisch schrieb:

> Anything wrong with:
> class Foo(object):
>    pass
> Foo.a = Foo
> ?

The problem with this is that there is also metaclass hacking involved
which relies on "a" 's creation in the class body. In your suggestion
"a" is not present when __new__ of the metaclass is called.

Servus, Gregor

More information about the Python-list mailing list