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


Groups > comp.lang.python > #52091

Re: Enum vs OrderedEnum

Newsgroups comp.lang.python
Subject Re: Enum vs OrderedEnum
References <CALwzidm5LSH891oAvK_tzNBY5K-BNS-D970Pa_LLxZXWCb6O9w@mail.gmail.com> <520182F1.2060709@stoneleaf.us> <mailman.286.1375832802.1251.python-list@python.org>
From "Rhodri James" <rhodri@wildebst.demon.co.uk>
Organization The Wildebestiary
Message-ID <op.w1e53beja8ncjz@gnudebeest> (permalink)
Date 2013-08-07 00:55 +0100

Show all headers | View raw


On Wed, 07 Aug 2013 00:46:39 +0100, Ian Kelly <ian.g.kelly@gmail.com>  
wrote:

> On Aug 6, 2013 5:15 PM, "Ethan Furman" <ethan@stoneleaf.us> wrote:
>>
>> Use the .value attribute instead.  You could also substitute self for
> Environment.
>
> It feels more natural and readable to compare the enum instances rather
> than their value attributes. If I am ordering the values then that seems  
> to
> imply that the enumeration itself is ordered. So I guess my question is
> better stated: is there a better way to do this that doesn't involve
> ordered comparisons at all?

You could create sets (frozensets?) of standard and hostile environments  
as class variables.

-- 
Rhodri James *-* Wildebeest Herder to the Masses

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


Thread

Re: Enum vs OrderedEnum Ian Kelly <ian.g.kelly@gmail.com> - 2013-08-06 17:46 -0600
  Re: Enum vs OrderedEnum "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2013-08-07 00:55 +0100

csiph-web