This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients alexdelorenzo, eric.smith, levkivskyi
Date 2018-08-10.00:49:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533862170.03.0.56676864532.issue34363@psf.upfronthosting.co.za>
In-reply-to
Content
Maybe do both, then. Also, it's probably better for performance reasons (I know: premature optimization and all that ...):

@@ -1018,8 +1018,10 @@ def _asdict_inner(obj, dict_factory):
             value = _asdict_inner(getattr(obj, f.name), dict_factory)
             result.append((f.name, value))
         return dict_factory(result)
-    elif isinstance(obj, (list, tuple)):
+    elif type(obj) in (list, tuple):
         return type(obj)(_asdict_inner(v, dict_factory) for v in obj)
+    elif isinstance(obj, (list, tuple)):
+        return type(obj)(*[_asdict_inner(v, dict_factory) for v in obj])
     elif isinstance(obj, dict):
         return type(obj)((_asdict_inner(k, dict_factory), _asdict_inner(v, dict_factory))
                           for k, v in obj.items())

I guess we could argue it's a bug in nametuples, but I don't see that getting us very far.
History
Date User Action Args
2018-08-10 00:49:30eric.smithsetrecipients: + eric.smith, levkivskyi, alexdelorenzo
2018-08-10 00:49:30eric.smithsetmessageid: <1533862170.03.0.56676864532.issue34363@psf.upfronthosting.co.za>
2018-08-10 00:49:29eric.smithlinkissue34363 messages
2018-08-10 00:49:29eric.smithcreate