ClassName.attribute vs self.__class__.attribute

Duncan Booth duncan.booth at invalid.invalid
Thu Jun 12 06:40:34 EDT 2008


Bruno Desthuilliers <bruno.42.desthuilliers at websiteburo.invalid> wrote:

> 
> FWIW, metaclasses do have a class attribute that refers to itself !-)
> 
One metaclass (i.e. type) has a class attribute that refers to itself.

Other metaclasses have a class attribute that refers to the metaclass's 
metaclass. I can't think of any situation where a metaclass would be its 
own metaclass except for 'type' itself, but then I think I've got a 
headache trying to think about this so maybe I'm wrong.

In fact, thinking about it a bit more, I think that if you did have another 
metaclass which is its own metaclass then the class cannot subclass 
'object'.

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list