[issue32854] Add ** Map Unpacking Support for namedtuple

2018-03-04 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___

[issue32854] Add ** Map Unpacking Support for namedtuple

2018-02-19 Thread Jay Crotts
Jay Crotts added the comment: Thanks Raymond, I wasn't sure if it was a common pattern or not, that makes sense. -- ___ Python tracker

[issue32854] Add ** Map Unpacking Support for namedtuple

2018-02-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I wandering if it is worth to add a general function that takes an object and a sequence of keys and return a mapping proxy that maps attribute names to values. -- ___ Python tracker

[issue32854] Add ** Map Unpacking Support for namedtuple

2018-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: > 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

[issue32854] Add ** Map Unpacking Support for namedtuple

2018-02-16 Thread Jay Crotts
Jay Crotts added the comment: Would it be worth adding an example of unpacking such as, t(**a._asdict()), or something similar to the documentation ? -- nosy: +jcrotts ___ Python tracker

[issue32854] Add ** Map Unpacking Support for namedtuple

2018-02-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Concur with Raymond. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue32854] Add ** Map Unpacking Support for namedtuple

2018-02-15 Thread Raymond Hettinger
Raymond Hettinger 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

[issue32854] Add ** Map Unpacking Support for namedtuple

2018-02-15 Thread John Crawford
New submission from John Crawford : At present, `collections.namedtuple` does not support `**` map unpacking despite being a mapping style data structure. For example: >>> from collections import namedtuple >>> A = namedtuple("A", "a b c") >>> a = A(10, 20, 30)