Structures

George Sakkis george.sakkis at gmail.com
Tue Nov 4 11:20:15 EST 2008


On Nov 3, 10:26 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Tue, 04 Nov 2008 00:19:16 +0000, Marc 'BlackJack' Rintsch wrote:
> > On Mon, 03 Nov 2008 23:32:25 +0000, Paulo J. Matos wrote:
>
> >> What's then the reason for adding named tuples if they are not
> >> mutable...???
>
> > Names are more descriptive than "magic numbers" as indices.  See for
> > example the "named tuple" returned by `os.stat()`.
>
> I have no objection to named tuples, but I've sometimes
> missed having an equivalent to the Pascal record or C
> struct: essentially a named mutable tuple.

+1. FWIW, I posted a recipe along these lines, following closely the
functionality and implementation of namedtuple: http://code.activestate.com/recipes/576555/

George



More information about the Python-list mailing list