2018-04-11 16:50 GMT+03:00 Chris Angelico <ros...@gmail.com>:

> Can you give an example of how your syntax is superior to the more
> general option of simply allowing "as" bindings in any location?
This is not my syntax :) And not even my idea. I just do not understand,
and even a little skeptical about allowing "as" bindings in **any
location** with global scoping. All the examples in this thread and the
previous ones, as well as almost all PEP's examples show how this feature
will be useful in `if`, `while` statements and comprehension/generator
expressions. And it excellently solves this problem.  This feature
increases the capabilities of these statements and also positively affects
the readability of the code and it seems to me that everyone understands
what this means in this context without ambiguity in their meaning in
`while` or `with` statements.

The remaining examples (general ones) are far-fetched, and I do not have
much desire to discuss them :)  These include:

lambda: x := lambda y: z := a := 0
y = ((eggs := spam()), (cheese := eggs.method()), cheese[eggs])
and others of these kind...

Thus, I do not understand why to solve such a general and complex problem,
when this syntax is convenient only in specific cases.  In addition,
previously the concept of a Statement-Local Name Bindings was discussed, which
I basically like (and it fits the above idea).  In this version, it was
abandoned completely, but it is unclear for what reasons.

p.s.: Maybe someone has use-cases outside `if`, `while` and comprehensions,
but so far no one has demonstrated them.

With kind regards,
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to