summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2013-07-30 19:24:25 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2013-07-30 19:24:25 (GMT)
commit90262625075cdfc32e77340f907d3a47ab6b47f1 (patch)
tree6f7974e2a789287337cc85bbaacf0315093726ec
parent20ac14fbada54df7e16e50d2f010329e0b14d4fd (diff)
downloadcpython-90262625075cdfc32e77340f907d3a47ab6b47f1.zip
cpython-90262625075cdfc32e77340f907d3a47ab6b47f1.tar.gz
cpython-90262625075cdfc32e77340f907d3a47ab6b47f1.tar.bz2
fixed examples to work with changed attribute names
-rw-r--r--Doc/library/enum.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 1e464d7..6864705 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -483,7 +483,7 @@ Avoids having to specify the value for each enumeration member::
... 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 @@ enumerations)::
>>> 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):