__getitem__ method on (meta)classes

Simon Percivall percivall at gmail.com
Tue Mar 15 03:09:55 CET 2005

Well, they're not synonymous. At least not in that context. If you
haven't already tried it, what you're doing will fail for instances as
well. Look in typeobject.c to see why. The gist of it is that the
special methods are looked up on the type rather than the instance (on
the metaclass rather than on the class, in your case), so the internal
lookup mechanism ignore instance attributes completely in this case.

More information about the Python-list mailing list