[Python-checkins] r60349 - python/trunk/Doc/library/collections.rst

raymond.hettinger python-checkins at python.org
Sun Jan 27 11:47:55 CET 2008


Author: raymond.hettinger
Date: Sun Jan 27 11:47:55 2008
New Revision: 60349

Modified:
   python/trunk/Doc/library/collections.rst
Log:
Removed an unnecessary and confusing paragraph from the namedtuple docs.

Modified: python/trunk/Doc/library/collections.rst
==============================================================================
--- python/trunk/Doc/library/collections.rst	(original)
+++ python/trunk/Doc/library/collections.rst	Sun Jan 27 11:47:55 2008
@@ -526,16 +526,7 @@
     Point: x= 3.000  y= 4.000  hypot= 5.000
     Point: x=14.000  y= 0.714  hypot=14.018
 
-Another use for subclassing is to replace performance critcal methods with
-faster versions that bypass error-checking::
-
-    class Point(namedtuple('Point', 'x y')):
-        __slots__ = ()
-        _make = classmethod(tuple.__new__)
-        def _replace(self, _map=map, **kwds):
-            return self._make(_map(kwds.get, ('x', 'y'), self))
-
-The subclasses shown above set ``__slots__`` to an empty tuple.  This keeps
+The subclass shown above sets ``__slots__`` to an empty tuple.  This keeps
 keep memory requirements low by preventing the creation of instance dictionaries.
 
 Subclassing is not useful for adding new, stored fields.  Instead, simply


More information about the Python-checkins mailing list