Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

Marko Rauhamaa marko at pacujo.net
Mon Mar 24 10:55:24 CET 2014

Ian Kelly <ian.g.kelly at gmail.com>:

> If lambda were going to be deprecated and removed then it already
> would have happened in Python 3, because Guido tried to do precisely
> that. I'm not sure what the reasons were for keeping it in the end
> (according to PEP 3099 it was because nobody suggested a suitable
> replacement), but if he couldn't get rid of it then, he never will.

You never *need* (Python's) lambda for anything. Inner functions are
more capable and almost always more readable. It doesn't hurt to have
lambda, but I don't find any use for it, either.


More information about the Python-list mailing list