[Python-3000] PEP 3113 (Removal of Tuple Parameter Unpacking) (original) (raw)

Christian Tanzer tanzer at swing.co.at
Mon Mar 5 09:54:48 CET 2007


Ka-Ping Yee <python at zesty.ca> wrote

On 3/4/07, Raymond Hettinger <python at rcn.com> wrote: > FWIW, I would like the feature to be kept. I've found it useful in that it > documents the function signature more completely when dealing > with arguments that are already pre-packed into tuples

I just noticed that this has a more noticeable effect on lambda, since you don't have room for another statement to do the unpacking. To sort a dictionary by value, you can currently write sorted(dict.items(), key=lambda (key, value): value) Without tuple unpacking, this idiom becomes sorted(dict.items(), key=lambda item: item[1]) obscuring the fact that the item is a (key, value) pair.

Oooops. I'd pretty much ignored the discussion because I thought that I didn't use tuple parameter unpacking anyway.

Unfortunately, I use it quite a bit with lambda. I shudder at the thought how those are going to look without tuple unpacking.

FWIW, I always liked the parameter passing is assignment semantics of Python. I sure hope nobody is going to start a crus^H^H^H^HPEP to remove tuple unpacking in general from the language!

-- Christian Tanzer http://www.c-tanzer.at/



More information about the Python-3000 mailing list