Is there a way to ask a class what its metaclasses are ?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Feb 23 04:21:53 EST 2009


En Mon, 23 Feb 2009 06:09:44 -0200, Barak, Ron <Ron.Barak at lsi.com>  
escribió:

>> > 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

This works fine for me with Python 2.5 and wx 2.8.7.1; Python 2.4 and wx  
2.6.1.0; even if CopyAndPaste is an old-style class.

<code>
import wx

class CopyAndPaste(object):
   pass

class ListControl(wx.Frame, CopyAndPaste):
   pass

app = wx.App()
frame = ListControl(None)
frame.Show(True)
app.MainLoop()
</code>

You'll have to provide more info on your setup...

-- 
Gabriel Genellina




More information about the Python-list mailing list