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

Mark H Harris harrismh777 at gmail.com
Mon Mar 24 20:16:15 EDT 2014


On 3/24/14 7:11 PM, Chris Angelico wrote:
> On Tue, Mar 25, 2014 at 10:56 AM, Mark H Harris<harrismh777 at gmail.com>  wrote:
>> What is needed is the explicit closure "grab" recommended by ChrisA.
>
> Which does work. You do know why, right?

Sure.  ... but again, that's not the point. The point is NOT can you 
explain why it works, the point is that as a lambda construct it is NOT 
clear why it works, and because the construct does not match what lambda 
users might expect (naturally) there are *constant* questions about it.

So, again, I'll restate that the community might consider (over time) 
whether the confusion created by lambda in python is worth the time and 
trouble to maintain the construct in the language. Is the value add 
worth the cost of confusion. I don't think so; others are bound to disagree.

marcus



More information about the Python-list mailing list