[Python-checkins] r59797 - python/trunk/Lib/collections.py
raymond.hettinger
python-checkins at python.org
Sun Jan 6 23:11:54 CET 2008
Author: raymond.hettinger
Date: Sun Jan 6 23:11:54 2008
New Revision: 59797
Modified:
python/trunk/Lib/collections.py
Log:
Speed-up named tuple's _make() constructor.
Modified: python/trunk/Lib/collections.py
==============================================================================
--- python/trunk/Lib/collections.py (original)
+++ python/trunk/Lib/collections.py Sun Jan 6 23:11:54 2008
@@ -65,9 +65,9 @@
def __new__(cls, %(argtxt)s):
return tuple.__new__(cls, (%(argtxt)s)) \n
@classmethod
- def _make(cls, iterable):
+ def _make(cls, iterable, new=tuple.__new__, len=len):
'Make a new %(typename)s object from a sequence or iterable'
- result = tuple.__new__(cls, iterable)
+ result = new(cls, iterable)
if len(result) != %(numfields)d:
raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))
return result \n
More information about the Python-checkins
mailing list