[Python-ideas] IntFlags
Cameron Simpson
cs at zip.com.au
Tue Mar 3 23:04:01 CET 2015
On 03Mar2015 19:27, Serhiy Storchaka <storchaka at gmail.com> wrote:
>On 03.03.15 18:40, Ethan Furman wrote:
>>This was in my original Enum code, but stripped out as not being needed at the time.
>>
>>If there is sufficient interest (and use-cases) I can add it back in.
>
>This would be good. I need IntFlags even more than IntEnum.
I am also +1.
I also probably use IntFlags (euqivalents) more often than IntEnums. It would
have been nice for my PEP-418 demo implementation:
https://bitbucket.org/cameron_simpson/css/src/tip/lib/python/cs/clockutils.py
I rolled my own _Clock_Flags there for this very reason.
>I made an implementation based on early implementations of IntEnum,
>but then IntEnum was changed too much and became incompatible with my
>extension.
>
>IntFlags should be a separate class, IntEnum is good with its restrictions.
I agree. I presume IntEnum|IntEnum might return an IntFlags? Or would that make
for a TypeError or ValueError and one be expected to start with IntFlags?
Cheers,
Cameron Simpson <cs at zip.com.au>
Trust the computer... the computer is your friend.
- Richard Dominelli <dominel at panix.com>
More information about the Python-ideas
mailing list