Op 26-11-15 om 14:56 schreef Marko Rauhamaa: > Antoon Pardon <antoon.par...@rece.vub.ac.be>: > >> I don't understand. What I propose would be a minor change in >> how list comprehension works. I don't see how your example >> can be turned into a list comprehension. > The list comprehension is only a special case of the interaction between > closures and variables. If you dabble with list comprehensions and > lambdas, you'll need to make consistent changes in closure semantics.
It would only dabble with the list comprehension not with the lambda. The effect of the change would only be that a list comprehension like [ <expression> for <var> in <iter> ] would implicitly be rewritten as follows: [ (lambda <var>: <expression>)(<var>) for <var> in <iter>] There would no change on how lambdas work or functions or closures. > BTW, all(!?) other languages from Java to Scheme share closure semantics > with Python so you would really be making a mess by changing Python. Not this proposal, which wouldn't touch closure semantics. -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list