[Python-ideas] Naming convention for Enums

Ethan Furman ethan at stoneleaf.us
Thu Sep 15 13:47:11 EDT 2016


On 09/15/2016 10:03 AM, Steven D'Aprano wrote:
> On Wed, Sep 14, 2016 at 09:51:32PM +1000, Chris Angelico wrote:

>> Perhaps the advice needs to be along the lines of: Decide what the
>> purpose of the enum is, and follow a naming convention accordingly.
>> Uppercase if you're basically making constants; lowercase if you're
>> not; etcetera.
>
> I can't think of any situation where Enums would *not* be treated as
> constants. Can you give an example?

Besides being CONSTANTS enum members are also Singletons, and since I find CamelCase easier to read than UPPERCASE I may use that instead; otherwise I leave it all lowercase.

--
~Ethan~


More information about the Python-ideas mailing list