diff options
Diffstat (limited to 'Doc/library/collections.rst')
-rw-r--r-- | Doc/library/collections.rst | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index d8339b5..0acde12 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -908,7 +908,7 @@ customize a prototype instance: >>> 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` : +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 @@ -917,6 +917,9 @@ and more efficient to use a simple :class:`~enum.Enum` : >>> class Status(Enum): ... open, pending, closed = range(3) + +.. seealso:: + * `Recipe for named tuple abstract base class with a metaclass mix-in <http://code.activestate.com/recipes/577629-namedtupleabc-abstract-base-class-mix-in-for-named/>`_ by Jan Kaliszewski. Besides providing an :term:`abstract base class` for |