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


Groups > comp.lang.python > #51600

Re: OrderedEnum examples

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'attribute': 0.07; 'expected.': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'python': 0.11; 'fine.': 0.16; 'received:69.93': 0.16; 'received:gateway01.websitewelcome.com': 0.16; 'renamed': 0.16; 'wrote:': 0.18; 'replacing': 0.19; 'examples': 0.20; 'seems': 0.21; 'example': 0.22; 'header:User-Agent:1': 0.23; 'looks': 0.24; 'van': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'probably': 0.32; 'url:python': 0.33; 'updated': 0.34; 'but': 0.35; 'in:': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'ian': 0.60; 'received:173': 0.61; 'name': 0.63; '30,': 0.65; 'here': 0.66; 'detail.': 0.68; 'jul': 0.74; '3.4': 0.84; 'self.value': 0.84; 'url:cpython': 0.84; 'url:rev': 0.84; '2013': 0.98
Date Tue, 30 Jul 2013 12:30:04 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: OrderedEnum examples
References <51f8036c$0$2995$6d4158fb@reader.xsnews.nl> <CALwzid=LocYTdqkbrOPea7XefEanETvCPWc0c02pFyMQYKZGig@mail.gmail.com>
In-Reply-To <CALwzid=LocYTdqkbrOPea7XefEanETvCPWc0c02pFyMQYKZGig@mail.gmail.com>
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender ([173.12.184.233]) [173.12.184.233]:39332
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 2
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
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.5338.1375213962.3114.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375213962 news.xs4all.nl 15881 [2001:888:2000:d::a6]:50309
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51600

Show key headers only | View raw


On 07/30/2013 11:58 AM, Ian Kelly wrote:
> On Tue, Jul 30, 2013 at 12:18 PM, Bas van der Wulp <Bas.vdWulp@gmail.com> wrote:
>> Replacing each occurrence of self._value with either self._value_ or
>> self.value in the examples seems to make them work as expected.
>>
>> Are both examples incorrect, or not intended to work in Python 2.x?
>
> The _value attribute was renamed _value_ in:
>
> http://hg.python.org/cpython/rev/511c4daac102
>
> It looks like the example wasn't updated to match.  You should
> probably just use self.value here since the name of the private
> attribute is an implementation detail.

In `__new__` it has to be `_value_`, but in the other methods `.value` works fine.  Updated the 3.4 example with `.value`.

--
~Ethan~

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


Thread

OrderedEnum examples Bas van der Wulp <Bas.vdWulp@gmail.com> - 2013-07-30 20:18 +0200
  Re: OrderedEnum examples Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-30 12:58 -0600
  Re: OrderedEnum examples Ethan Furman <ethan@stoneleaf.us> - 2013-07-30 11:38 -0700
  Re: OrderedEnum examples Ethan Furman <ethan@stoneleaf.us> - 2013-07-30 12:16 -0700
  Re: OrderedEnum examples Ethan Furman <ethan@stoneleaf.us> - 2013-07-30 12:30 -0700
    Re: OrderedEnum examples Bas van der Wulp <Bas.vdWulp@gmail.com> - 2013-07-31 00:30 +0200

csiph-web