Is there a way to ask a class what its metaclasses are ?
Ron.Barak at lsi.com
Mon Feb 23 09:09:44 CET 2009
> -----Original Message-----
> From: chris at rebertia.com [mailto:chris at rebertia.com] On
> Behalf Of Chris Rebert
> Sent: Sunday, February 22, 2009 22:12
> To: Barak, Ron
> Cc: python-list at python.org
> Subject: Re: Is there a way to ask a class what its metaclasses are ?
> On Sun, Feb 22, 2009 at 5:14 AM, Barak, Ron <Ron.Barak at lsi.com> wrote:
> > Hi Chris,
> > Is there a way to ask a class what its metaclasses are ?
> > (e.g., how to ask wx.Frame what it's metaclass is)
> Of course. A metaclass is the type of a class, so it's just
When I try the following (to see the types of the classes involved):
from Debug import _line as line
def __init__(self, *args, **kwargs):
super(CopyAndPaste, self).__init__(*args, **kwargs)
print line()+". type(wx.Frame):",type(wx.Frame)
print line()+". type(object):",type(object)
$ python -u CopyAndPaste.py
9. type(wx.Frame): <type 'type'>
10. type(object): <type 'type'>
And I don't understand what it means...
In any case, it does not seem to help me resolve the metaclasses exception.
> Follow the path of the Iguana...
> > I'm asking, because, even subclassing from object, viz.:
> > class CopyAndPaste(object):
> > def __init__(self):
> > pass
> > ...
> > Still gives me:
> > $ python -u ./failover_pickle_demo09.py Traceback (most recent call
> > last):
> > File "./failover_pickle_demo09.py", line 321, in <module>
> > class ListControlMeta(wx.Frame, CopyAndPaste):
> > TypeError: Error when calling the metaclass bases
> > metaclass conflict: the metaclass of a derived class must be a
> > (non-strict) subclass of the metaclasses of all its bases
> > Bye,
> > Ron.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list