summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-06 09:02:24 +0000
committerRaymond Hettinger <python@rcn.com>2008-01-06 09:02:24 +0000
commit1166872006157361df619c431459f03bf6b27f74 (patch)
tree6bef9f142abc48ab6e58fcd98314d64957d832dc
parenteb94d4c3e3c3649518cfc85872ffd5870d6f5403 (diff)
downloadcpython-git-1166872006157361df619c431459f03bf6b27f74.tar.gz
Small code simplification. Forgot that classmethods can be called from intances.
-rw-r--r--Doc/library/collections.rst2
-rw-r--r--Lib/collections.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index eaa823a926..0205cf1aa8 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -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
diff --git a/Lib/collections.py b/Lib/collections.py
index 9985f93fc9..39b9229f57 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -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()