On 24/05/2018 16:54, Alexander Belopolsky wrote:
I have read most of the PEP 572 related threads, but I don't think I've seen this idea.  As many other people mentioned, Python already allows a trick to introduce local bindings in generator expressions and list comprehensions.  This can be achieved by adding a "for var in [<expr>]" clause. I propose to make "for var = <expr>" have the same effect as "for var in [<expr>]".


I made this exact same suggestion some time ago (not in the context of PEP 572).  Guido rejected it because it is easy (especially for newbies) to confuse
    for var in expr
    for var = expr
I point out that the confusion is particularly acute in the cases such as
    for x = SomeTuple
Rob Cliffe
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to