On 04/13/2016 07:21 AM, Ethan Furman wrote:
On 04/13/2016 07:07 AM, Marko Rauhamaa wrote:

     class Color(enum.Enum):
         red
         blue
         green


This last one is to the point but raises a NameError.

Using the aenum library that last one is possible.  It also has
NamedConstant and a metaclass-derived NamedTuple! </shameless plug>

Oh, and to keep it mostly safe, the magic that creates the missing names is turned off as soon as something real happens, like creating a property or a method.

--
~Ethan~

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to