[Python-checkins] cpython (3.5): Remove confusing section from named tuple recipes.
raymond.hettinger
python-checkins at python.org
Tue Nov 10 03:00:23 EST 2015
https://hg.python.org/cpython/rev/d71da4496f62
changeset: 99036:d71da4496f62
branch: 3.5
parent: 99033:37ebf174e9f0
user: Raymond Hettinger <python at rcn.com>
date: Tue Nov 10 00:00:00 2015 -0800
summary:
Remove confusing section from named tuple recipes.
files:
Doc/library/collections.rst | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -942,16 +942,6 @@
>>> johns_account = default_account._replace(owner='John')
>>> janes_account = default_account._replace(owner='Jane')
-Enumerated constants can be implemented with named tuples, but it is simpler
-and more efficient to use a simple :class:`~enum.Enum`:
-
- >>> Status = namedtuple('Status', 'open pending closed')._make(range(3))
- >>> Status.open, Status.pending, Status.closed
- (0, 1, 2)
- >>> from enum import Enum
- >>> class Status(Enum):
- ... open, pending, closed = range(3)
-
.. seealso::
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list