[PySide] pickling enums (again)

Hugo Parente Lima hugo.lima at openbossa.org
Fri Apr 26 17:41:38 CEST 2013


On Friday, April 26, 2013 02:36:04 PM lloyd konneker wrote:
> I know this is not a high priority and has been visited before.
> 
> 1) I posted an unreliable workaround at
> https://bugreports.qt-project.org/browse/PYSIDE-15 (unreliable since
> dict.keys() is arbitrarily ordered?)
> 
> 2) Is pickling of Qt enums working in PyQt and just needs someone to port it
> to PySide?  (If so, I might try.)
> 
> 3) In a previous post http://article.gmane.org/gmane.comp.lib.qt.pyside/1083
> Hugo objected to allowing type int in Qt methods where a type Qt enum was
> expected.  IMHO that is too strong and unPythonic.  It is not always the
> duty of PySide to enforce type checking.  Especially since enums in C++ are
> not very strict (allow comparison to ints, allow comparison between
> different enum types, etc.  See discussions of "enum class" for C++11.)
> Maybe relaxing enforcement for those methods that take parameters of type
> Qt enum where the enum is a subclass of int would allow easier unpickling
> of Qt enums (But not all Qt enums such as Qt.GlobalColor are subclasses of
> int?) And maybe there is a better solution.

Hi,

I still object to "cast any integer to an enum", you could argue that this 
isn't pythonic due to the strong type check, however this would imply into a 
possible segmentation fault on C++ side which I would say isn't pythonic 
either.

> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130426/ca996125/attachment.sig>


More information about the PySide mailing list