Are multiple return values really harmful? (Re: determining the number of output arguments)

Alex Martelli aleaxit at
Wed Nov 17 23:56:31 CET 2004

Carlos Ribeiro <carribeiro at> wrote:

> But perhaps we could have something like "named tuples"; immutable
> objects, like tuples, with the property that a unique name can be
> associated to every item.

Of course we should -- I've lost count of how many recipes in the
cookbook I've merged that were implementing that idea in umpteen ways,
not counting several other ideas that only flew by in this NG.  Since
standard modules time, os (for stat), resource (dunno if any others),
started returning this kind of supertuples, their convenience has been
obvious to all.  I do believe they SHOULD _be_ tuples (that matters when
they're the only RHS argument of a % formatting operator) and it should
also be easy to get from them a name->value mapping (for % formatting
with named-items format style, and the like).  Definitely PEP time...
who's gonna carry the torch?


More information about the Python-list mailing list