Bug or intended behavior?

Michael Torrie torriem at gmail.com
Mon Jun 5 15:45:58 EDT 2017


On 06/05/2017 01:26 PM, Marko Rauhamaa wrote:
> Interestingly, however, Python hasn't extended that principle to the
> expression syntax. You could have:
> 
>    >>> 1 + 2*3
>    7
>    >>> 1+2 * 3
>    9

And thankfully they didn't. Because it wouldn't make sense to do so.

Having whitespace indenting mimics how one thinks of blocks of code and
how one might wright it in pseudocode. For expressions, however, no one
thinks or writes pseudo-equations without considering the order of
operations.  Completely different things.  Maybe if the use of
parenthesis was relatively recent, you might make an argument, but
unlike braces, the use of parenthesis to override order of operations
goes back hundreds of years, far longer than programming languages have
been defining blocks.




More information about the Python-list mailing list