[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
- Previous message: [Python-3000] PEP 3113 (Removal of Tuple Parameter Unpacking)
- Next message: [Python-3000] PEP 3113 (Removal of Tuple Parameter Unpacking)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-3000] PEP 3113 (Removal of Tuple Parameter Unpacking)
- Next message: [Python-3000] PEP 3113 (Removal of Tuple Parameter Unpacking)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]