Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106945

Re: Enum questions.

From Ethan Furman <ethan@stoneleaf.us>
Newsgroups comp.lang.python
Subject Re: Enum questions.
Date 2016-04-13 07:21 -0700
Message-ID <mailman.74.1460557246.15650.python-list@python.org> (permalink)
References (1 earlier) <CAGgTfkPfcwamSgRFH9PwuVV4MGsnDwcZOD1=bS=7z+RWnEP0eg@mail.gmail.com> <nelir9$163$1@ger.gmane.org> <mailman.72.1460555456.15650.python-list@python.org> <878u0htxe5.fsf@elektro.pacujo.net> <570E55F4.3050006@stoneleaf.us>

Show all headers | View raw


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>

--
~Ethan~

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Enum questions. Grant Edwards <grant.b.edwards@gmail.com> - 2016-04-13 13:50 +0000
  Re: Enum questions. Marko Rauhamaa <marko@pacujo.net> - 2016-04-13 17:07 +0300
    Re: Enum questions. Ethan Furman <ethan@stoneleaf.us> - 2016-04-13 07:21 -0700
    Re: Enum questions. Ethan Furman <ethan@stoneleaf.us> - 2016-04-13 14:13 -0700

csiph-web