Message312219
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. |
|
Date |
User |
Action |
Args |
2018-02-15 18:52:50 | rhettinger | set | recipients:
+ rhettinger, John Crawford |
2018-02-15 18:52:50 | rhettinger | set | messageid: <1518720770.89.0.467229070634.issue32854@psf.upfronthosting.co.za> |
2018-02-15 18:52:50 | rhettinger | link | issue32854 messages |
2018-02-15 18:52:50 | rhettinger | create | |
|