Re: Named tuples and projection

2008-06-20 Thread Giuseppe Ottaviano
[snip] Provided you don't change the order of the items in the tuple, you can just use slicing: a, b = f()[ : 2] Yes, this is what you would normally do with tuples. But i find this syntax very implicit and awkward. Also, you cannot skip elements, so you often end up with things like a,

Re: Named tuples and projection

2008-06-20 Thread MRAB
On Jun 20, 9:38 am, Giuseppe Ottaviano <[EMAIL PROTECTED]> wrote: > I found the namedtuple very convenient for rapid prototyping code, for   > functions that have to return a number of results that could grow as   > the code evolves. They are more elegant than dicts, and I don't have   > to create

Named tuples and projection

2008-06-20 Thread Giuseppe Ottaviano
I found the namedtuple very convenient for rapid prototyping code, for functions that have to return a number of results that could grow as the code evolves. They are more elegant than dicts, and I don't have to create a new explicit class. Unfortunately in this situation they lose the conv