Differences creating tuples and collections.namedtuples
steve+comp.lang.python at pearwood.info
Tue Feb 19 09:57:25 CET 2013
Pardon me for the double-post, if any, my news client appears to have
eaten my first reply.
On Mon, 18 Feb 2013 23:48:46 -0800, raymond.hettinger wrote:
> If your starting point is an existing iterable such as s=['Guido',
> 'BDFL', 1], you have a couple of choices: p=Person(*s) or
> p=Person._make(s). The latter form was put it to help avoid unpacking
> and repacking the arguments.
It might not be obvious to the casual reader, but despite the leading
underscore, _make is part of the public API for namedtuple:
More information about the Python-list