[Python-ideas] Re: Revise using the colon ( : )

2023-09-20 Thread Dom Grigonis
My bad, you have pointed to ambiguity accurately.

Thanks for taking time to correct me.

Regards,
DG

> On 20 Sep 2023, at 16:09, Celelibi  wrote:
> 
> 2023-09-12 7:10 UTC+02:00, Dom Grigonis :
>> I don’t think your example depicts the ambiguity well.
>> 
>> 1. is the correct parsing of the Original1, 2. is the correct parsing of
>> Original2 and 3. is not correct for either of those.
>> 
>> Original1
>>> while a < b (x := c) - 42
>> Original2
>>> while a < b(x := c) - 42
> 
> They're the same. AFAIK `foo(...)` and `foo (...)` are parsed exactly
> the same way. A space in this place is irrelevant. And it's unlikely
> to change in the next few decades.
> 
>> 
>> 1. In this case, it’s obviously this one
>>> while a < b:
>>>   (x := c) - 42
> 
> Why tho? Why would this one be more obvious than the other
> alternatives? What would be the rules to decide? If I may quote the
> PEP 20:
>> In the face of ambiguity, refuse the temptation to guess.
> 
>> 2. In here your removed the space, which is not ambiguity, but rather
>> mistype
> Again, the space in this place doesn't matter. I removed it to show
> more explicitely how it could be parsed.
> 
>> 3. Same as in 2. But also, this is not an option, because if there was no
>> indent on the next line, then body exists. So this is incorrect.
>>> Or:
>>> while a < b(x := c) - 42:
>>>   # ???
> 
> I actually think this is the better parsing of the three: a SyntaxError.
> 
> 
> Celelibi
> ___
> 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/WSOJIXRMEYCNQGVNABPCJJ4S23PB6X4L/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
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/RQBYA3FMKBL6OXZWJ55XAT26CKOPH7EU/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Revise using the colon ( : )

2023-09-20 Thread Celelibi
2023-09-12 7:10 UTC+02:00, Dom Grigonis :
> I don’t think your example depicts the ambiguity well.
>
> 1. is the correct parsing of the Original1, 2. is the correct parsing of
> Original2 and 3. is not correct for either of those.
>
> Original1
>> while a < b (x := c) - 42
> Original2
>> while a < b(x := c) - 42

They're the same. AFAIK `foo(...)` and `foo (...)` are parsed exactly
the same way. A space in this place is irrelevant. And it's unlikely
to change in the next few decades.

>
> 1. In this case, it’s obviously this one
>> while a < b:
>>(x := c) - 42

Why tho? Why would this one be more obvious than the other
alternatives? What would be the rules to decide? If I may quote the
PEP 20:
> In the face of ambiguity, refuse the temptation to guess.

> 2. In here your removed the space, which is not ambiguity, but rather
> mistype
Again, the space in this place doesn't matter. I removed it to show
more explicitely how it could be parsed.

> 3. Same as in 2. But also, this is not an option, because if there was no
> indent on the next line, then body exists. So this is incorrect.
>> Or:
>> while a < b(x := c) - 42:
>># ???

I actually think this is the better parsing of the three: a SyntaxError.


Celelibi
___
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/WSOJIXRMEYCNQGVNABPCJJ4S23PB6X4L/
Code of Conduct: http://python.org/psf/codeofconduct/