[Python-ideas] Tighten up the formal grammar and parsing a bit?

Serhiy Storchaka storchaka at gmail.com
Mon May 15 10:49:58 EDT 2017


On 15.05.17 16:00, Steven D'Aprano wrote:
> There's also cases where
>
>     if x > y:
>         pass
>     else:
>         code
>
> is *not necessarily* the same as
>
>     if not (x > y):
>         code

This is not true.

     if not cond:
         stmt1
     else:
         stmt2

always is equivalent to

     if cond:
         stmt2
     else:
         stmt1




More information about the Python-ideas mailing list