Looking for the best way to translate an idiom

Fuzzyman fuzzyman at gmail.com
Sun Dec 14 17:59:26 EST 2008


On Dec 14, 5:51 pm, Paul  Moore <p.f.mo... at gmail.com> wrote:
> On 14 Dec, 16:22, Bruno Desthuilliers
>
> <bdesth.quelquech... at free.quelquepart.fr> wrote:
> > if you only want the first returned value, you can just apply a slice:
>
> > def f():
> >     return 1,2,3
>
> > a = f()[0] + 1
>
> Hmm, true. I'm not sure it's any less ugly, though :-)
>
> > FWIW, Python 2.6 has NamedTuple objects...
>
> I know, but I want to target 2.5+ (I still have a number of systems
> running 2.5)
>

There is a Python implementation of NamedTuple on the Python cookbook
that is compatible with Python 2.5.

Michael Foord
http://www.ironpythoninaction.com/



More information about the Python-list mailing list