[PyKDE] converting enum types

Patrick Stinson patrickkidd.lists at gmail.com
Fri Jun 9 17:20:53 BST 2006


yeah, as with most things python, they look a little closer to the
real concept of an enum, with little attention payed to the
implementation details of such a thing in C.

On 6/9/06, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> On Thursday 08 June 2006 10:18 pm, Eron Lloyd wrote:
> > On 6/8/06, Patrick Stinson <patrickkidd.lists at gmail.com> wrote:
> > > On 6/8/06, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> > > > On Thursday 08 June 2006 2:55 pm, Patrick Stinson wrote:
> > > > > It seems like everywhere that there is an enum value returned from a
> > > > > function, like QInputEvent.modifiers(), you get a class defined by
> > > > > pyqt. What is the idea behind returning an object of this type
> > > > > instead of an int,
> > > >
> > > > Because enums aren't ints, they are distinct types.
> > >
> > > funny what you forget when you forsake the rest of the world for a
> > > life in python...
> >
> > Indeed. However, let's hope Python gets first class enums of its own
> > soon: http://www.python.org/dev/peps/pep-0354/
>
> But you couldn't use what's proposed to wrap C++ enums. At the very least you
> would need to be able to specify the numeric value associated with each
> member and override the default determined by the position of the member in
> the enum ctor.
>
> Phil
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>


-- 
Patrick Kidd Stinson
http://www.patrickkidd.com/
http://pkaudio.sourceforge.net/
http://pksampler.sourceforge.net/




More information about the PyQt mailing list