[Python-ideas] constant/enum type in stdlib (original) (raw)

Ethan Furman ethan at stoneleaf.us
Wed Jan 30 18:19:36 CET 2013


On 01/30/2013 08:26 AM, Antoine Pitrou wrote:

Le Wed, Michael Foord a écrit :

With a Python 3 metaclass that provides default values for looked up entries you could have this:

class Color(Enum): RED, WHITE, BLUE This relies on tuple evaluation order, and would also evaluate any other symbol looked up from inside the class body (which means I cannot add anything else than enum symbols to the class).

Probably a dumb question, but why would you want to add non-enum to an enum class?

Ethan



More information about the Python-ideas mailing list