[Python-checkins] cpython: fixed examples to work with changed attribute names
ethan.furman
python-checkins at python.org
Tue Jul 30 21:25:05 CEST 2013
http://hg.python.org/cpython/rev/2b3b873e2b19
changeset: 84916:2b3b873e2b19
user: Ethan Furman <ethan at stoneleaf.us>
date: Tue Jul 30 12:24:25 2013 -0700
summary:
fixed examples to work with changed attribute names
files:
Doc/library/enum.rst | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -483,7 +483,7 @@
... def __new__(cls):
... value = len(cls.__members__) + 1
... obj = object.__new__(cls)
- ... obj._value = value
+ ... obj._value_ = value
... return obj
...
>>> class Color(AutoNumber):
@@ -505,19 +505,19 @@
>>> class OrderedEnum(Enum):
... def __ge__(self, other):
... if self.__class__ is other.__class__:
- ... return self._value >= other._value
+ ... return self.value >= other.value
... return NotImplemented
... def __gt__(self, other):
... if self.__class__ is other.__class__:
- ... return self._value > other._value
+ ... return self.value > other.value
... return NotImplemented
... def __le__(self, other):
... if self.__class__ is other.__class__:
- ... return self._value <= other._value
+ ... return self.value <= other.value
... return NotImplemented
... def __lt__(self, other):
... if self.__class__ is other.__class__:
- ... return self._value < other._value
+ ... return self.value < other.value
... return NotImplemented
...
>>> class Grade(OrderedEnum):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list