summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-04-02 22:25:40 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-04-02 22:25:40 (GMT)
commit756ab67a9867cd158aa63d9ac5ce99809e0a2175 (patch)
tree335fbc440020f794de4d8b10108d3f0d3e3356f6 /Lib/collections.py
parent789be0c0a0656d17f831aa781cf7c5d55e5b4835 (diff)
downloadcpython-756ab67a9867cd158aa63d9ac5ce99809e0a2175.zip
cpython-756ab67a9867cd158aa63d9ac5ce99809e0a2175.tar.gz
cpython-756ab67a9867cd158aa63d9ac5ce99809e0a2175.tar.bz2
Have namedtuple's field renamer assign names that
are consistent with the corresponding tuple index.
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 d77aff5..fb53900 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -178,7 +178,7 @@ def namedtuple(typename, field_names, verbose=False, rename=False):
if (not all(c.isalnum() or c=='_' for c in name) or _iskeyword(name)
or not name or name[0].isdigit() or name.startswith('_')
or name in seen):
- names[i] = '_%d' % (i+1)
+ names[i] = '_%d' % i
seen.add(name)
field_names = tuple(names)
for name in (typename,) + field_names: