summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-03-23 21:38:39 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-03-23 21:38:39 (GMT)
commit15d0c1d0738b2146949c0f6769c3945d41dfa426 (patch)
tree0533082b203ca8eb9c117389e15d7fdd371e96a7
parent28dff612876096af152c377c14ad60f9e134831a (diff)
downloadcpython-15d0c1d0738b2146949c0f6769c3945d41dfa426.zip
cpython-15d0c1d0738b2146949c0f6769c3945d41dfa426.tar.gz
cpython-15d0c1d0738b2146949c0f6769c3945d41dfa426.tar.bz2
Minor clean-ups.
-rw-r--r--Lib/collections/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 652e4f1..5f11f6a 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -321,7 +321,9 @@ def namedtuple(typename, field_names, verbose=False, rename=False):
for index, name in enumerate(field_names):
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 not name
+ or name[0].isdigit()
+ or name.startswith('_')
or name in seen):
field_names[index] = '_%d' % index
seen.add(name)
@@ -351,8 +353,7 @@ def namedtuple(typename, field_names, verbose=False, rename=False):
for index, name in enumerate(field_names))
)
- # Execute the class definition string in a temporary namespace and
- # support tracing utilities by setting a value for frame.f_globals['__name__']
+ # Execute the class definition string in a temporary namespace
namespace = {}
try:
exec(class_definition, namespace)