[Python-Dev] Re: stdlib Flag Enums and the "no value" member

2021年4月29日 11:03:22 -0700

On 4/29/21 10:35 AM, Jonathan Goble wrote:
> On Thu, Apr 29, 2021 at 1:20 PM Ethan Furman wrote:
>> Which raises the question: Do we want to have a standard name for stdlib 
Flags when no flags are set?
>
> If you want a flag to represent no flags set, it takes one line to write it 
yourself, as in this example I copied
> verbatim from the docs:
>
> >>> class Color(Flag):
> ... BLACK = 0
> ... RED = auto()
> ... BLUE = auto()
> ... GREEN = auto()
> ...
> >>> Color.BLACK
> <Color.BLACK: 0>
> >>> bool(Color.BLACK)
> False
Are you suggesting that the standard name for 0 be 'BLACK'? ;-)
--
~Ethan~
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/U365WUWGJBGFVMEXUQUFRPHAONTB7CJP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to