24.05.18 18:54, Alexander Belopolsky пише:
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>]".

It was discussed before (at least in the context of comprehensions), and was rejected because in some other popular languages `for var = <expr>` is the same as `for var in <expr>` in Python.

_______________________________________________
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