Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51600
| Date | 2013-07-30 12:30 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: OrderedEnum examples |
| References | <51f8036c$0$2995$6d4158fb@reader.xsnews.nl> <CALwzid=LocYTdqkbrOPea7XefEanETvCPWc0c02pFyMQYKZGig@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5338.1375213962.3114.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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