OrderedEnum examples

Bas van der Wulp Bas.vdWulp at gmail.com
Wed Jul 31 00:30:28 CEST 2013


On 30-7-2013 21:30, Ethan Furman wrote:
> 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 at 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~

That was quick! Thanks Ethan and Ian.

Regards,
Bas



More information about the Python-list mailing list