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


Groups > comp.lang.python > #52089

Re: Enum vs OrderedEnum

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.050
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'attribute': 0.07; 'imply': 0.09; 'all?': 0.16; 'attributes.': 0.16; 'enum': 0.16; 'readable': 0.16; 'substitute': 0.16; '\xa0you': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'aug': 0.22; 'instead.': 0.24; 'question': 0.24; '&gt;': 0.26; 'compare': 0.26; 'values': 0.27; 'header:In-Reply- To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'guess': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'instances': 0.36; 'ordered': 0.36; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'environment.': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'more': 0.64; 'natural': 0.68; '5:15': 0.84; 'enumeration': 0.84; 'ordered.': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=39RCmGvqSU81hKUNP78y8A4NPyFuHP+CW1B5NFb9F5k=; b=SEss2mT1mW2/YEi5ZSPtJMZZgc4wyJ6TQCd3444AEIbM8xDuRqN0jewC9WQmgQi3mH bMUP7smzQsMRsRq9y4s3gI1wvC+2K8FT1Z8//rgKc1sg/53dbJcSH39zA3OQ2tXvfoXG Dc7WxhkiKGnuz+rwAQQWax6FPJs/nB9VgJZ+T0K851Z1FthNe/cx+/vj05BqBWBU7TGh WZa46qFInvuxKGj5R4wWlyWGLkwsftA2sCzYZA0ii76fjVUXjtt2aKzFCeHcDiW/UY3H BjtJjcvtzbR9MAkXvur/4S4SvWczqzB6bs/LvDzdrK9ISxvZ22kqds3EWcRa293tOJwc HU4g==
MIME-Version 1.0
X-Received by 10.68.129.138 with SMTP id nw10mr516052pbb.158.1375832799382; Tue, 06 Aug 2013 16:46:39 -0700 (PDT)
In-Reply-To <520182F1.2060709@stoneleaf.us>
References <CALwzidm5LSH891oAvK_tzNBY5K-BNS-D970Pa_LLxZXWCb6O9w@mail.gmail.com> <520182F1.2060709@stoneleaf.us>
Date Tue, 6 Aug 2013 17:46:39 -0600
Subject Re: Enum vs OrderedEnum
From Ian Kelly <ian.g.kelly@gmail.com>
To Python <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7b10ce1f4715e704e35009d0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.286.1375832802.1251.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375832802 news.xs4all.nl 15884 [2001:888:2000:d::a6]:41272
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52089

Show key headers only | View raw


[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?

Back to comp.lang.python | Previous | NextNext 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