[Python-ideas] IntFlags
Neil Girdhar
mistersheik at gmail.com
Wed Mar 4 05:55:23 CET 2015
Also +1.
I think IntFlags should also have a named constructor that constructs an
IntFlags instance from a set:
reduce(lambda x, y: x | y, (c[key] for key in some_set))
Best,
Neil
On Tuesday, March 3, 2015 at 5:04:50 PM UTC-5, Cameron Simpson wrote:
>
> On 03Mar2015 19:27, Serhiy Storchaka <stor... at gmail.com <javascript:>>
> 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 <c... at zip.com.au <javascript:>>
>
> Trust the computer... the computer is your friend.
> - Richard Dominelli <dom... at panix.com <javascript:>>
> _______________________________________________
> Python-ideas mailing list
> Python... at python.org <javascript:>
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150303/f144ce51/attachment.html>
More information about the Python-ideas
mailing list