]> granicus.if.org Git - python/commitdiff
fixed examples to work with changed attribute names
authorEthan Furman <ethan@stoneleaf.us>
Tue, 30 Jul 2013 19:24:25 +0000 (12:24 -0700)
committerEthan Furman <ethan@stoneleaf.us>
Tue, 30 Jul 2013 19:24:25 +0000 (12:24 -0700)
Doc/library/enum.rst

index 1e464d7361df7a25f4774aceb02daecb084bc4ff..686470534d62563943073ef222c629843b83b50b 100644 (file)
@@ -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):