[Python-Dev] Py2.6 ideas

Giovanni Bajo rasky at develer.com
Fri Feb 16 02:35:33 CET 2007


On 15/02/2007 20.59, Raymond Hettinger wrote:

> * Add a pure python named_tuple class to the collections module.  I've been 
> using the class for about a year and found that it greatly improves the 
> usability of tuples as records. 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/500261

+1 from me too, I've been using a class with the same name and semantic 
(though an inferior implementation) for almost two years now, with great benefits.

As suggested in the cookbook comment, please consider changing the semantic of 
  the generated constructor so that it accepts a single iterable positional 
arguments (or keyword arguments). This matches tuple() (and other containers) 
in behaviour, and makes it easier to substitute existing uses with named tuples.
-- 
Giovanni Bajo



More information about the Python-Dev mailing list