Reference class in class creation
duncan.booth at invalid.invalid
Tue Nov 21 14:14:17 CET 2006
Gregor Horvath <gh at gregor-horvath.com> wrote:
> Diez B. Roggisch schrieb:
>> Anything wrong with:
>> class Foo(object):
>> 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.
The class doesn't exist until the metaclass has created it, so you can't
expect to have any references to it.
You've told us that what you are trying to do doesn't work, but you haven't
said why you want to do it. What is the problem you are really trying to
More information about the Python-list