Re: Problems with subclassing enum34

2013-06-28 Thread Ethan Furman
On 06/28/2013 08:32 AM, Thomas Heller wrote: Am 28.06.2013 17:25, schrieb Thomas Heller: Robert Kern: enum.EnumMeta uses super() in its __new__() implementation but _ctypes.PyCSimpleType doesn't. Thus, only _ctypes.PyCSimpleType.__new__() gets a chance to run. Switching the order of the two m

Re: Problems with subclassing enum34

2013-06-28 Thread Robert Kern
On 2013-06-28 16:32, Thomas Heller wrote: Am 28.06.2013 17:25, schrieb Thomas Heller: Robert Kern: enum.EnumMeta uses super() in its __new__() implementation but _ctypes.PyCSimpleType doesn't. Thus, only _ctypes.PyCSimpleType.__new__() gets a chance to run. Switching the order of the two migh

Re: Problems with subclassing enum34

2013-06-28 Thread Thomas Heller
Am 28.06.2013 17:25, schrieb Thomas Heller: Robert Kern: enum.EnumMeta uses super() in its __new__() implementation but _ctypes.PyCSimpleType doesn't. Thus, only _ctypes.PyCSimpleType.__new__() gets a chance to run. Switching the order of the two might work. Robert found the problem but I'm

Re: Problems with subclassing enum34

2013-06-28 Thread Thomas Heller
Am 28.06.2013 17:16, schrieb Ethan Furman: On 06/28/2013 03:48 AM, Thomas Heller wrote: trying out the enum34 module. What I want to create is a subclass of enum.Enum that is also based on ctypes.c_int so that I can better use enum instances in ctypes api calls. Have you tried using enum.IntE

Re: Problems with subclassing enum34

2013-06-28 Thread Ethan Furman
On 06/28/2013 03:48 AM, Thomas Heller wrote: trying out the enum34 module. What I want to create is a subclass of enum.Enum that is also based on ctypes.c_int so that I can better use enum instances in ctypes api calls. Have you tried using enum.IntEnum? If you were able to pass ints in befor

Re: Problems with subclassing enum34

2013-06-28 Thread 88888 Dihedral
Thomas Heller於 2013年6月28日星期五UTC+8下午6時48分38秒寫道: > trying out the enum34 module. > > > > What I want to create is a subclass of enum.Enum that is also > > based on ctypes.c_int so that I can better use enum instances > > in ctypes api calls. > > > > When I do this, I get a metaclass conflict:

Re: Problems with subclassing enum34

2013-06-28 Thread Robert Kern
On 2013-06-28 11:48, Thomas Heller wrote: trying out the enum34 module. What I want to create is a subclass of enum.Enum that is also based on ctypes.c_int so that I can better use enum instances in ctypes api calls. When I do this, I get a metaclass conflict: >>> class MyEnum(ctypes.c_int,

Problems with subclassing enum34

2013-06-28 Thread Thomas Heller
trying out the enum34 module. What I want to create is a subclass of enum.Enum that is also based on ctypes.c_int so that I can better use enum instances in ctypes api calls. When I do this, I get a metaclass conflict: >>> class MyEnum(ctypes.c_int, enum.Enum): ...FOOBAR = 0 ... Traceback