<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 14, 2018 at 11:54 PM, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Sun, Apr 15, 2018 at 1:08 PM, Nick Coghlan <<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>> wrote:<br>
> === Target first, 'from' keyword ===<br>
><br>
>     while (value from read_next_item()) is not None: # New<br>
>         ...<br>
><br>
> Pros:<br>
><br>
>   * avoids the syntactic ambiguity of "as"<br>
>   * being target first provides an obvious distinction from the "as" keyword<br>
>   * typically reads nicely as pseudocode<br>
>   * "from" is already associated with a namebinding operation ("from<br>
> module import name")<br>
><br>
> Cons:<br>
><br>
>   * I'm sure we'll think of some more, but all I have so far is that<br>
> the association with name binding is relatively weak and would need to<br>
> be learned<br>
><br>
<br>
</span>Cons: Syntactic ambiguity with "raise exc from otherexc", probably not serious.<br>
<br></blockquote><div><br></div><div>To me, "from" strongly suggests that an element is being obtained from a container/collection of elements. This is how I conceptualize "from module import name": "name" refers to an object INSIDE the module, not the module itself. If I saw<br><br></div><div>if (match from pattern.search(data)) is not None:<br>
        ...<br><br></div><div>I would guess that it is equivalent to<br><br></div><div>m = next(pattern.search(data))<br></div><div>if m is not None:<br>
        ...<br><br></div><div>i.e. that the target is bound to the next item from an iterable (the "container").<br><br></div><div>Cheers,<br></div><div>Nathan <br></div></div><br></div></div>