]> granicus.if.org Git - python/commitdiff
Small code simplification. Forgot that classmethods can be called from intances.
authorRaymond Hettinger <python@rcn.com>
Sun, 6 Jan 2008 09:02:24 +0000 (09:02 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 6 Jan 2008 09:02:24 +0000 (09:02 +0000)
Doc/library/collections.rst
Lib/collections.py

index eaa823a92629c190ac81ffba4b1e3adac721892a..0205cf1aa8c0fd11b2455d38ecc8690fa994bfee 100644 (file)
@@ -410,7 +410,7 @@ Example::
 
            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
index 9985f93fc9639ed44622d0c3d2b5bc735485e1b0..39b9229f578d3a4940fdd7c4f678a02bd3260eff 100644 (file)
@@ -78,7 +78,7 @@ def namedtuple(typename, field_names, verbose=False):
             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()