[Python-ideas] proper naming of Enum members

Nick Coghlan ncoghlan at gmail.com
Tue Jul 19 00:54:40 EDT 2016


On 19 July 2016 at 01:41, Guido van Rossum <guido at python.org> wrote:
> Honestly my own preference would be to use UPPER_CASE, emphasizing the
> const-ness. CapWords is really only used for classes, which are
> entirely different beasts. And lower_case is for methods and
> variables. I think it's useful to emphasize that an enum is neither.

I haven't used enum much outside the standard library, but my C/C++
background would push me towards CAP_WORDS since they're constants.

That also has the virtue of making the standard library uses no longer
a special case - they're just CAP_WORDS-because-they're-constants,
rather than CAP_WORDS-because-they're-defined-by-a-third-party-C-API

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list