[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Request for Comments: Support for C++ Scoped Enums
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2017-08-11 21:15:11
Message-ID: F2220484-7819-49D9-9C09-5E27E66364A9 () riverbankcomputing ! com
[Download RAW message or body]

On 11 Aug 2017, at 5:56 pm, Shaheed Haque <srhaque@theiet.org> wrote:
> 
> On 11 August 2017 at 16:22, Phil Thompson <phil@riverbankcomputing.com> 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.

I'll make sure any error message prompts the user to install...

https://pypi.python.org/pypi/enum34/

...but only because it is easy to do. I'm not promising to support Python2 for any \
new features. I don't see why you would want to want to target Python2 for a new (and \
substantial) package.

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic