Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!panix!roy From: Roy Smith Newsgroups: comp.lang.python Subject: Re: Differences creating tuples and collections.namedtuples Date: Mon, 18 Feb 2013 20:11:38 -0500 Organization: PANIX Public Access Internet and UNIX, NYC Lines: 13 Message-ID: References: <7a40a426-baa9-46f8-8f9d-59ba32b044f3@googlegroups.com> NNTP-Posting-Host: localhost X-Trace: reader1.panix.com 1361236299 672 127.0.0.1 (19 Feb 2013 01:11:39 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 19 Feb 2013 01:11:39 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: csiph.com comp.lang.python:39151 Terry Reedy wrote: > Initializaing a namedtuple from an iterable is unusual, and > hence gets the longer syntax. I I quick look through our codebase agrees with that. I found 27 namedtuple classes. 21 were initialized with MyTuple(x, y, z) syntax. Three used MyTuple(*data). Most interesting were the three that used MyTuple(**data). In all three cases, data was a dictionary returned by re.match.groupdict(). The definition of the namedtuple was even built by introspecting the regex to find all the named groups!