[Python-Dev] removing nested tuple function parameters

François Pinard pinard at iro.umontreal.ca
Mon Sep 19 02:37:40 CEST 2005

[Raymond Hettinger]

> [Brett]
> > Is anyone truly attached to nested tuple function parameters; ``def
> > fxn((a,b)): print a,b``?

> I am.

I like the possibility and use it once in a while, but not often, at
least not enough to beg for its preservation, or cry after its loss.
Having to go without it, a mere tuple unpacking line near the beginning
of the function would do.

The only practical reason to like this feature is sparing the need of
finding an otherwise useless name for the formal argument.  Another
reason, but not practical at all, is that the concept conveys some
elegance and originality (each programming language should ideally have
a few of these) and is enforced in other places in Python, like in the
`for' statement -- where I find implied unpacking very, very useful.

Yet, if I was given the choice between nested tuple function arguments,
and faster argument processing, the latter would win instantly.

> > ditching them thanks to the pain they caused in the AST branch.

> Changing the grammar for the convenience of a particular AST
> implementation carries zero weight with me -- that is the tail wagging
> the dog.

A very funny image! :-)

François Pinard   http://pinard.progiciels-bpi.ca

More information about the Python-Dev mailing list