Reference class in class creation

Gregor Horvath gh at gregor-horvath.com
Tue Nov 21 07:52:29 EST 2006


Diez B. Roggisch schrieb:

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

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