Users demand iterable input for named tuples. The author capitulates.
diff --git a/Lib/collections.py b/Lib/collections.py
index 3d98f7c..c6d0d0f 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -62,6 +62,7 @@
__slots__ = () \n
def __new__(cls, %(argtxt)s):
return tuple.__new__(cls, (%(argtxt)s)) \n
+ _cast = classmethod(tuple.__new__) \n
def __repr__(self):
return '%(typename)s(%(reprtxt)s)' %% self \n
def _asdict(t):
@@ -69,7 +70,7 @@
return {%(dicttxt)s} \n
def _replace(self, **kwds):
'Return a new %(typename)s object replacing specified fields with new values'
- return %(typename)s(*map(kwds.get, %(field_names)r, self)) \n
+ return %(typename)s._cast(map(kwds.get, %(field_names)r, self)) \n
@property
def _fields(self):
return %(field_names)r \n\n''' % locals()