From 56145242930f98cbb1553888566d30a98158bfc8 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 2 Apr 2009 22:31:59 +0000 Subject: Have namedtuple's field renamer assign names that are consistent with the corresponding tuple index. --- Lib/collections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/collections.py') diff --git a/Lib/collections.py b/Lib/collections.py index 002ce9724d..786a9f784a 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: -- cgit v1.2.1