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


Groups > comp.lang.python > #52089 > unrolled thread

Re: Enum vs OrderedEnum

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2013-08-06 17:46 -0600
Last post2013-08-07 00:55 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#52089 — Re: Enum vs OrderedEnum

FromIan Kelly <ian.g.kelly@gmail.com>
Date2013-08-06 17:46 -0600
SubjectRe: Enum vs OrderedEnum
Message-ID<mailman.286.1375832802.1251.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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?

[toc] | [next] | [standalone]


#52091

From"Rhodri James" <rhodri@wildebst.demon.co.uk>
Date2013-08-07 00:55 +0100
Message-ID<op.w1e53beja8ncjz@gnudebeest>
In reply to#52089
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web