Raymond Hettinger <[email protected]> added the comment:
The intended way to support **unpacking is the _asdict() method:
t(**a._asdict())
It doesn't really make sense to add direct support for **unpacking because
named tuples are sequences and not mappings. To support **unpacking, we would
have to add a keys() method and modify __getitem__() to handle both integer
indexing and string key lookup. Once we have **a and a[k] and a.keys(), people
would also want a.values() a.items() etc. The world gets murky when both
sequence and mapping behaviors become commingled.
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32854>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com