[PySide] pickling enums (again)

John Ehresman jpe at wingware.com
Tue May 7 01:48:21 CEST 2013


> On 05/06/2013 03:38 PM, Robin Dunn wrote:
>> I'm not sure if PyQt is doing anything different, but I've been using
>> SIP lately (for the new wxPython) and things like pickle or copy
>> module operations work fine with enum values.  IIRC SIP implements
>> each enum as a class that derives from int and the enum values are
>> instances of that class.

This is probably the way to go, though it's probably worth looking at
what comes out of the current python-dev discussion of adding enums to
the standard library.

On 5/6/13 7:08 PM, lloyd konneker wrote:
> Thanks for your responses.  For my problem, which is pickling PySide Qt
> enums, I think there is a workaround.

I do think pickling and copying should work out of the box.  The code to
handle enums is generated by shiboken so changing the code generator
will affect all (or at least nearly all) of the places enums are used.
I'm also relatively unconcerned about the overhead since the other steps
in the value conversion process probably will take more time than
finding the correct value.  We do need to be concerned about backward
compatibility and source compatibility with PyQt.

Cheers,

John



More information about the PySide mailing list