[Python-ideas] IntFlags

random832 at fastmail.us random832 at fastmail.us
Wed Mar 4 20:48:26 CET 2015


On Tue, Mar 3, 2015, at 17:16, Chris Angelico wrote:
> class Color(IntEnum):
>     black = 0
>     red = 1
>     green = 2
>     orange = 3
>     blue = 4
>     magenta = 5
>     cyan = 6
>     white = 7
> 
> With colors, it makes no sense to combine them in any way (addition,
> bitwise or, etc). You can't put blue and cyan together and expect to
> get something usable.

Except for the part where green|blue==cyan... and if only you'd said
yellow instead of orange it'd hold across the board. I assume you took
these values from ANSI colors.


More information about the Python-ideas mailing list