Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)
breamoreboy at yahoo.co.uk
Sat Mar 22 18:57:21 CET 2014
On 22/03/2014 09:09, Ian Kelly wrote:
> On Fri, Mar 21, 2014 at 8:06 PM, Rustom Mody <rustompmody at gmail.com> wrote:
>> Two: A comprehension variable is not bound but reassigned across the
>> comprehension. This problem remains in python3 and causes weird behavior when
>> lambdas are put in a comprehension
> Because Python as a language only has the concept of assignment, not
> binding. I think it would be weird and confusing if variables worked
> this way in comprehensions and nowhere else.
My understanding has always been that an expression of the rhs is bound
to a name of the lhs. So is my understanding wrong, or is the above
wrong, or are we talking at cross purposes, or what?
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
This email is free from viruses and malware because avast! Antivirus protection is active.
More information about the Python-list