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

Ka-Ping Yee python at zesty.ca
Mon Mar 5 09:42:27 CET 2007


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.

-- ?!ng



More information about the Python-3000 mailing list