[Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

Chris Angelico rosuav at gmail.com
Sat Apr 14 23:54:49 EDT 2018


On Sun, Apr 15, 2018 at 1:08 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> === Target first, 'from' keyword ===
>
>     while (value from read_next_item()) is not None: # New
>         ...
>
> Pros:
>
>   * avoids the syntactic ambiguity of "as"
>   * being target first provides an obvious distinction from the "as" keyword
>   * typically reads nicely as pseudocode
>   * "from" is already associated with a namebinding operation ("from
> module import name")
>
> Cons:
>
>   * I'm sure we'll think of some more, but all I have so far is that
> the association with name binding is relatively weak and would need to
> be learned
>

Cons: Syntactic ambiguity with "raise exc from otherexc", probably not serious.

ChrisA


More information about the Python-ideas mailing list