[Python-checkins] r59765 - in python/trunk: Doc/library/collections.rst Lib/collections.py

raymond.hettinger python-checkins at python.org
Sun Jan 6 10:02:25 CET 2008


Author: raymond.hettinger
Date: Sun Jan  6 10:02:24 2008
New Revision: 59765

Modified:
   python/trunk/Doc/library/collections.rst
   python/trunk/Lib/collections.py
Log:
Small code simplification.  Forgot that classmethods can be called from intances.

Modified: python/trunk/Doc/library/collections.rst
==============================================================================
--- python/trunk/Doc/library/collections.rst	(original)
+++ python/trunk/Doc/library/collections.rst	Sun Jan  6 10:02:24 2008
@@ -410,7 +410,7 @@
 
            def _replace(self, **kwds):
                'Return a new Point object replacing specified fields with new values'
-               result = self.__class__._make(map(kwds.pop, ('x', 'y'), self))
+               result = self._make(map(kwds.pop, ('x', 'y'), self))
                if kwds:
                    raise ValueError('Got unexpected field names: %r' % kwds.keys())
                return result

Modified: python/trunk/Lib/collections.py
==============================================================================
--- python/trunk/Lib/collections.py	(original)
+++ python/trunk/Lib/collections.py	Sun Jan  6 10:02:24 2008
@@ -78,7 +78,7 @@
             return {%(dicttxt)s} \n
         def _replace(self, **kwds):
             'Return a new %(typename)s object replacing specified fields with new values'
-            result = self.__class__._make(map(kwds.pop, %(field_names)r, self))
+            result = self._make(map(kwds.pop, %(field_names)r, self))
             if kwds:
                 raise ValueError('Got unexpected field names: %%r' %% kwds.keys())
             return result \n\n''' % locals()


More information about the Python-checkins mailing list