A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-September/128874.html below:

[Python-Dev] Enum Eccentricities

[Python-Dev] Enum EccentricitiesEthan Furman ethan at stoneleaf.us
Mon Sep 23 01:52:36 CEST 2013
http://bugs.python.org/issue19011

So, as anyone who has worked with Enum is probably aware by now, Enum's are a strange duck -- you might even call them 
platypuses.

For example, Enum members are instances of the class, but they are defined inside the class structure, and new ones 
cannot be created afterwards; Enum classes also support iteration and containment checks.

What I'm looking for feedback on is the question is #19011: should an Enum member be considered a class level attribute?

On the one hand, they are defined inside the class, and they are accessed via dot notation (EnumClass.member).

On the other hand, inside the class they look like 3 and 5 and 'up' and 'east', and they don't live in the class dictionary.

Also, if we change Enum so that members do act more like class attributes, then things like Color.red.blue.green.blue 
will result in Color.blue, and that seems stranger to me than having class instances be available on the class without 
be full-fledged class-attributes.

Thoughts?  Opinions?  Pearls of wisdom?

--
~Ethan~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4