|
|
|
|
|
by filmor
3347 days ago
|
|
Your first point is incorrect, lambda works with the first syntax for both python 2 and 3. What /has/ changed, however, is the implicit destructuring: l = lambda (a, b): a + b
l((1, 2))
I suspect there are very good reasons not to allow something like this.With regard to the second point, I also would have liked a more "gradual" step there, I find myself (especially in REPL environments) often doing `list(map(sth, sth))`. A `mapi`, `filteri` or something like this would probably not be zenny enough. Both don't pose very strong points for python 2 > 3. |
|
These seem like OK reasons, but I find myself continuously needing the destructuring idiom in lambdas, while these introspection and documentation concerns are just not there for me.
However tuple-parameters being an exception to rules (such as args and kwargs not being usable with them) is more compelling. And allowing destructuring only in lambdas would be weird, because they wouldn't be normal function objects any more.
Unless the destructuring was only syntactic sugar for the translation in the PEP? But that's again inconsistent.