Should 3.4 enums use UPPER_CASE_WITH_UNDERSCORES?

Update

The BDFL (Benevolent Dictator For Life) has spoken, and the Enum documentation has changed to reflect all upper-case member names.


The examples in the [previous] docs are lower-case primarily because one of the preexisting modules that Enum was based on used lower-case (or at least its author did ;).

My usage of enum has usually been something along the lines of:

class SomeEnum(Enum):
    ... = 1
    ... = 2
    ... = 3
globals().update(SomeEnum.__members__)

which effectively puts all the members in the module namespace.

So I would say whichever style feels more comfortable to you — but pick a style and be consistent.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)