From: Raymond Hettinger Date: Tue, 10 Nov 2015 08:00:00 +0000 (-0800) Subject: Remove confusing section from named tuple recipes. X-Git-Tag: v3.5.1rc1~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=549e34cc7bb5af347512c9feae1b917f5fb65479;p=thirdparty%2FPython%2Fcpython.git Remove confusing section from named tuple recipes. --- diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 8ab757194a63..8841db649dc7 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -942,16 +942,6 @@ customize a prototype instance: >>> 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::