[Python-ideas] namedtuple literals [Was: RE a new namedtuple]
shoyer at gmail.com
Wed Jul 19 21:21:05 EDT 2017
On Wed, Jul 19, 2017 at 6:08 PM, Guido van Rossum <guido at python.org> wrote:
> Regarding that spec, I think there's something missing: given a list (or
> tuple!) of values, how do you turn it into an 'ntuple'? That seems a common
> use case, e.g. when taking database results like row_factory in sqlite3.
One obvious choice is to allow for construction from a dict with **kwargs
unpacking. This actually works now that keyword arguments are ordered.
This would mean either ntuple(**kwargs) or the possibly too cute (**kwargs)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas