On Thu, May 21, 2020 at 4:36 PM Thierry Parmentelat <
thierry.parmente...@inria.fr> wrote:

> > Again, if I saw a unicode arrow used as syntax on GitHub or something in
> the wild right now, I would think it's an error, which incidentally would
> be correct. Wouldn't you?
>
> yes, like I would have taken a walrus operator for a syntax error just a
> couple years ago maybe; things change..


I think you make a good point, but it's not quite the same.

If I see:

```
if (match := re.match(...)):
   x = match.group(1)
```

and I don't know what `:=` means, I pretty much have to Google it, guess,
or otherwise learn. I'm not going to think that a colon was accidentally
added to `match = re.match(...)` because that's not valid syntax either. I
*might* think it's supposed to be `match == re.match(...)`, but that would
just raise more questions - `match` is an undefined variable, and you don't
compare match objects. Besides, how did this mistake happen? Didn't this
person run their code?

If I see:

```
def foo() → Bar:
 ```

I'm going to think that either:

1. Some fancy rendering is going on, like the ligatures some have been
talking about. Right *now*, that's probably the most likely hypothesis,
considering that some people do this in their editors. If it was actually
valid syntax, I'd be surprised when that reasonable guess turned out wrong,
especially if I paste it somewhere and get a SyntaxError with my slightly
outdated Python. Which leads me to the next guess...
2. In the process of transferring from the editor to a
blog/email/document/etc the code has been mangled. I don't know exactly
how, but someone was complaining on this list recently that plain ASCII
quotes had turned into fancy matching quotes which lead to a confusing
error message. So it seems plausible that `->` got transformed somehow.
It's not similarly plausible that `==` randomly became `:=`.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/GEHCJV7CF4D5CILMITVFU62D7432OPQP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to