summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-04-02 22:31:59 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-04-02 22:31:59 (GMT)
commit56145242930f98cbb1553888566d30a98158bfc8 (patch)
tree977bef7779f6036cbbcb7cff6b1e7e0aed5d8693 /Lib/collections.py
parentc26d43966d8d54fc90b254b60bed2f33f693c155 (diff)
downloadcpython-56145242930f98cbb1553888566d30a98158bfc8.zip
cpython-56145242930f98cbb1553888566d30a98158bfc8.tar.gz
cpython-56145242930f98cbb1553888566d30a98158bfc8.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 002ce97..786a9f7 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -174,7 +174,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: