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

2021年4月29日 11:56:54 -0700

On 2021年04月29日 18:56, Ethan Furman wrote:
On 4/29/21 10:52 AM, Antoine Pitrou wrote:
 > On 2021年4月29日 18:37:29 +0100, MRAB wrote:
 >> On 2021年04月29日 18:19, Ethan Furman wrote:
 >>> An excerpt from bpo-31369: re.RegexFlag and `__all__`
 >>>
 >>> GvR:
 >>> ----
 >>> > One thing I discovered when developing this example: there doesn't 
seem to be a flag to
 >>> > represent 0 (zero), i.e. "no flags". And foo(0) is a type error 
(even though it works
 >>> > fine at runtime).
 >>>
 >>> Which raises the question: Do we want to have a standard name for stdlib 
Flags when no flags are set?
 >>>
 >>> What should we call it?
 >>>
 >>> - NONE
 >>>
 >>> - ZERO
 >>>
 >>> - EMPTY
 >>>
 >>> - ???
 >>>
 >> Definitely NONE. At some point I might even add it to the regex module! :-)
 >
 > Not to confuse with None, which will not be equal to NONE. Hmm...
 >
 > Perhaps NONE_SET or ALL_UNSET?
 >
 > (also, why the ALL_CAPS?)
Since Enum members are constants, ALL_CAPS is recommended for their naming 
scheme.
And the flags of the re module have always been ALL_CAPS.
_______________________________________________
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/DCKIHYXVZIRABF43M3NX75RZAXIQ3AOV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to