A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/056490.html below:

[Python-Dev] removing nested tuple function parameters

[Python-Dev] removing nested tuple function parametersGuido van Rossum guido at python.org
Mon Sep 19 19:21:28 CEST 2005
On 9/19/05, Terry Reedy <tjreedy at udel.edu> wrote:
> 
> I consider the current situation to be a consistency feature.  To a first
> approximation, Python function calls 'pass' objects by name-binding:
> 
> param_name_list = arg_object_list
> 
> Disabling structure unpacking in this assignment would make the language
> slightly more complex.  Someone else posted the same observation in c.l.p.

Maybe, but there are enough differences between parameter/argument
lists and sequences that this consistency sounds rather foolish to me.
 In fact, the feature came from a similar feature in ABC, but in ABC,
parameter lists *were* considered assignment targets -- the outer
level of parentheses was just a special case of tuple unpacking. Not
so in Python, which has keyword parameters, *varargs, **keywords, and
where f(x,) is the same as f(x) -- even though (x,) is a tuple and (x)
is not.

Also, I bet many people will be surprised to know that this code doesn't work:

  add = lambda (x, y): x+y
 print add(1, 2)

> Another thought.  By directly unpacking and not naming a sequence, one
> 'announces' that only the components are of interest and that nothing will
> be done with the sequence object itself.

Fair enough, though I'm not sure what use we can make of that information.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4