def a((b,c,d),e):

François Pinard pinard at iro.umontreal.ca
Tue Apr 19 09:55:12 EDT 2005


[George Sakkis]
> François Pinard wrote:

> > The most useful place for implicit tuple unpacking, in my
> > experience, is likely at the left of the `in' keyword in `for'
> > statements (and it is even nicer when one avoids extraneous
> > parentheses).

> ... and would be nicest (IMO) if default arguments and *varargs were
> allowed too; check http://tinyurl.com/dcb2q for a relevant thread.

It's appealing, indeed, trying to create more uniformity between tuple
unpacking and argument passing.  There are two approaches towards such
uniformity, either upgrading tuple unpacking (as the above thread
discusses) or downgrading argument passing (as suggested by those who
found atrocious the current behaviour).

I started recently to study the R system and language, and saw many good
ideas in there about argument passing.  Translated in Python terms, it
would mean that `*varargs' and `**keywords' are not necessary last,
that named keywords may be intermixed with positional keywords, that
keywords may be abbreviated, and much more hairy, that the default
values for keywords are not pre-evaluated at `def' time, and that
the computation of actual expressions given as arguments is lazily
postponed until their first use within the function.  It surely looks
all strange at first, but these choices are surprisingly productive in
practice, as I merely begin to understand.  Curious minds may start at
http://cran.r-project.org/doc/manuals/R-lang.html#Arguments and read
down.  I do not know if there will ever be cross-pollinisation between R
and Python, but I would guess good things might came out of this...

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



More information about the Python-list mailing list