[CentralOH] __metaclass__

Steven Huwig steven_h at acm.org
Thu Jun 26 18:31:52 CEST 2008

I tried to replicate this on my 2.5.2 install and was unable to do it.
Do you have a minimum failing example?

On Thu, Jun 26, 2008 at 12:13 PM, Mark Erbaugh <mark at microenh.com> wrote:
> 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.
> _______________________________________________
> CentralOH mailing list
> CentralOH at python.org
> http://mail.python.org/mailman/listinfo/centraloh

More information about the CentralOH mailing list