--===============8883898317819230511== Content-Type: multipart/alternative; boundary="001a1142900422ee7105567d310d" --001a1142900422ee7105567d310d Content-Type: text/plain; charset="UTF-8" On 11 August 2017 at 16:22, Phil Thompson wrote: > At the moment SIP only supports C-like unscoped enums and implements them > as sub-classes of int. The main weaknesses of these are the lack of type > safety and the injection of the member names into the enclosing scope. > > These problems were fixed by the introduction of scoped enums in newer > versions of C++, see... > > https://www.ibm.com/developerworks/rational/library/scoped-enums/index. > html > > Note that Qt doesn't currently use scoped enums but I expect that to > change. > > Scoped enums are much closer to the implementation of Python enums... > > https://docs.python.org/3/library/enum.html#module-enum > > I propose to add support for scoped enums and implement them using Python > enums - specifically as sub-classes of Enum (and *not* IntEnum in order to > preserve the type safety). Consequently Python v3.4 or later will be > required for wrapping libraries using scoped enums. > > Any comments welcome. > > Phil > _______________________________________________ > PyQt mailing list PyQt@riverbankcomputing.com > https://www.riverbankcomputing.com/mailman/listinfo/pyqt My present focus is on Python2.7, and though I am keen to move onto 3, that's perhaps some weeks/months off. So, if there is some basic support for 2, that would allow me to transition in my own time. --001a1142900422ee7105567d310d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On 11 August 2017 at 16:22, Phil Thompson <phil@riverbankcom= puting.com> wrote:
At the m= oment SIP only supports C-like unscoped enums and implements them as sub-cl= asses of int. The main weaknesses of these are the lack of type safety and = the injection of the member names into the enclosing scope.

These problems were fixed by the introduction of scoped enums in newer vers= ions of C++, see...

https://www.ibm.com/= developerworks/rational/library/scoped-enums/index.html

Note that Qt doesn't currently use scoped enums but I expect that to ch= ange.

Scoped enums are much closer to the implementation of Python enums...

https://docs.python.org/3/library/enum.h= tml#module-enum

I propose to add support for scoped enums and implement them using Python e= nums - specifically as sub-classes of Enum (and *not* IntEnum in order to p= reserve the type safety). Consequently Python v3.4 or later will be require= d for wrapping libraries using scoped enums.

Any comments welcome.

Phil
_______________________________________________
PyQt mailing list=C2=A0 =C2=A0 PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

My present focus is on Python2.7, and though I am keen to move onto = 3, that's perhaps some weeks/months off. So, if there is some basic sup= port for 2, that would allow me to transition in my own time.

--001a1142900422ee7105567d310d-- --===============8883898317819230511== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KUHlRdCBtYWls aW5nIGxpc3QgICAgUHlRdEByaXZlcmJhbmtjb21wdXRpbmcuY29tCmh0dHBzOi8vd3d3LnJpdmVy YmFua2NvbXB1dGluZy5jb20vbWFpbG1hbi9saXN0aW5mby9weXF0 --===============8883898317819230511==--