On 2018-07-04 17:22, Chris Angelico wrote:
- the "if expr as name:" syntax is able to handle only the tiniest
proportion of cases, because many MANY situations require a condition
after that. You can't write this, for instance:

if f(x) as spam < 0:
     print(spam)

The original use cases didn't ask for these compound conditions. In fact many of the other threads this week are advising folks to break up an expression with compound conditions due to lack of readability.

The common cases described:

- compute value once in a comprehension
- loop and a half (reading file, socket)
- common regex match

More complex cases can be handled the old way.

> Python uses "as NAME" for things that
> are quite different from this, so it's confusing),

It's less confusing, and limited. No one bats an eyelash after using "as" day after day in Python and SQL.

Good day,
-Mike
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to