[CentralOH] __metaclass__
Mark Erbaugh
mark at microenh.com
Thu Jun 26 18:13:07 CEST 2008
I've discovered something strange with some Python 2.4.3 code that I'm
working on.
I have a class, Query, that sets __metaclass__. The class is designed
to be derived from and children of this class have been working.
This morning, I created a new child class, but I also named it Query
import query_base as Q
class Query(Q.Query):
The class didn't work and upon investigation, it looks like the
metaclass is not being used. IOW, once the instance is created,
<instance>.__metaclass_ returns None
However, if I change the name of the class to something else, everything
works and <instance>.__metaclass__ has the expected value.
It looks like Python or I are violating a namespace somewhere.
Obviously, the immediate solution is to not re-use the name, but that
happens to be a very good name for the class.
I'm really more interested in understanding what's actually going on.
More information about the CentralOH
mailing list