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: 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; '>': 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: <520182F1.2060709@stoneleaf.us> Date: Tue, 6 Aug 2013 17:46:39 -0600 Subject: Re: Enum vs OrderedEnum From: Ian Kelly To: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --047d7b10ce1f4715e704e35009d0 Content-Type: text/plain; charset=ISO-8859-1 On Aug 6, 2013 5:15 PM, "Ethan Furman" 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? --047d7b10ce1f4715e704e35009d0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Aug 6, 2013 5:15 PM, "Ethan Furman" <ethan@stoneleaf.us> wrote:
>
> Use the .value attribute instead. =A0You could also substitute self fo= r Environment.

It feels more natural and readable to compare the enum insta= nces rather than their value attributes. If I am ordering the values then t= hat seems to imply that the enumeration itself is ordered. So I guess my qu= estion is better stated: is there a better way to do this that doesn't = involve ordered comparisons at all?

--047d7b10ce1f4715e704e35009d0--