[Python-Dev] Py2.6 ideas

Delaney, Timothy (Tim) tdelaney at avaya.com
Fri Feb 16 00:12:09 CET 2007


Guido van Rossum wrote:

> On 2/15/07, Raymond Hettinger <raymond.hettinger at verizon.net> 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
> 
> Hm, but why would they still have to be tuples? Why not just have a
> generic 'record' class?

Hmm - possibilities. "record" definitely has greater connotations of
heterogeneous elements than "tuple", which would put paid to the
constant arguments that "a tuple is really just an immutable list".

list - primarily intended for homogeneous elements
record - primarily intended for heterogeneous elements, elements are
(optionally?) named

and have mutable and immutable versions of each. Maybe the current list
syntax would then continue to create a mutable list, and the current
tuple syntax would create an immutable record (with no element names)
i.e. the current tuple.

Tim Delaney


More information about the Python-Dev mailing list