summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-11-15 02:55:42 (GMT)
committerRaymond Hettinger <python@rcn.com>2007-11-15 02:55:42 (GMT)
commit5681cbce812d3daf19eab3a58631076148aa22c8 (patch)
treef9e5c0fc42641c3d3c9c2d71a76f19e6192aa5b8 /Lib/collections.py
parenteeeb9c4445391f0ec91d84d5f35634ffe42c66de (diff)
downloadcpython-5681cbce812d3daf19eab3a58631076148aa22c8.zip
cpython-5681cbce812d3daf19eab3a58631076148aa22c8.tar.gz
cpython-5681cbce812d3daf19eab3a58631076148aa22c8.tar.bz2
Small improvement to the implementation of __replace__().
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index 6b2e58d..7381a3a 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -64,7 +64,7 @@ def namedtuple(typename, field_names, verbose=False):
return dict(zip(%(field_names)r, self))
def __replace__(self, **kwds):
'Return a new %(typename)s object replacing specified fields with new values'
- return %(typename)s(**dict(self.__asdict__().items() + kwds.items())) \n''' % locals()
+ return %(typename)s(**dict(zip(%(field_names)r, self) + kwds.items())) \n''' % locals()
for i, name in enumerate(field_names):
template += ' %s = property(itemgetter(%d))\n' % (name, i)
if verbose: