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


Groups > comp.lang.python > #52091

Re: Enum vs OrderedEnum

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer02.iad.highwinds-media.com!feed-me.highwinds-media.com!peer01.fr7!news.highwinds-media.com!peer03.am1!peering.am1!npeersf04.am4!fx20.am4.POSTED!not-for-mail
Content-Type text/plain; charset=us-ascii; format=flowed; delsp=yes
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>
MIME-Version 1.0
Content-Transfer-Encoding 8bit
From "Rhodri James" <rhodri@wildebst.demon.co.uk>
Organization The Wildebestiary
Message-ID <op.w1e53beja8ncjz@gnudebeest> (permalink)
User-Agent Opera Mail/12.16 (Linux)
Lines 20
NNTP-Posting-Host 81.97.70.240
X-Complaints-To http://netreport.virginmedia.com
X-Trace 1375833350 81.97.70.240 (Tue, 06 Aug 2013 23:55:50 UTC)
NNTP-Posting-Date Tue, 06 Aug 2013 23:55:50 UTC
Date Wed, 07 Aug 2013 00:55:49 +0100
X-Received-Bytes 1651
Xref csiph.com comp.lang.python:52091

Show key headers only | 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