Message312276
> Would it be worth adding an example of unpacking such as,
> t(**a._asdict()), or something similar to the documentation ?
There are a myriad of uses for dictionaries and the namedtuple docs don't seem like to right place to cover them (**unpacking, str.format_map, str.__mod__, etc). Even the dict and OrderedDict docs don't cover these.
Also, the use of somefunc(**nt._asdict()) isn't a common pattern. A requirement for **unpacking tends to nudge design choices towards an actual mapping rather than a tuple or tuple subclass for the underlying data store. That is likely why this hasn't come-up before. |
|
Date |
User |
Action |
Args |
2018-02-17 08:13:55 | rhettinger | set | recipients:
+ rhettinger, serhiy.storchaka, jcrotts, John Crawford |
2018-02-17 08:13:55 | rhettinger | set | messageid: <1518855235.27.0.467229070634.issue32854@psf.upfronthosting.co.za> |
2018-02-17 08:13:55 | rhettinger | link | issue32854 messages |
2018-02-17 08:13:54 | rhettinger | create | |
|