[issue40721] PEP0435 (enums) -- there is no standard on enum item letters case

Rémi Lapeyre report at bugs.python.org
Thu May 21 17:50:03 EDT 2020


Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:

There is no official way, you can find both in the Python tree: all caps at https://github.com/python/cpython/blob/master/Lib/ast.py#L615-L636 and snake case at https://github.com/python/cpython/blob/master/Lib/uuid.py#L76-L79.

I think it's common to use all caps for those that are used as flags (i.e. where each value is a power of 2 and that may be combined using bigs operations) but there is no one true way that you can enforced, it depends on the context. 

Also, note that pep8 covers the code of Python, it's not a rule that must be blindly applied to all Python code and that you may ignore it for various reasons: https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds.

----------
nosy: +remi.lapeyre

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40721>
_______________________________________


More information about the Python-bugs-list mailing list