python styles: why Use spaces around arithmetic operators?

Thomas Jollans thomas at jollans.com
Mon Jul 26 19:00:50 EDT 2010


On 07/27/2010 12:20 AM, Peng Yu wrote:
> This webpage http://www.python.org/dev/peps/pep-0008/ recommends the
> following. It looks to me that both styles are fine. Could anybody let
> me know what the rationale is behind this recommendation?

Beauty is in the eye of the beholder, even when we call it "coding style".

There is no rationale, except if you accept "easier to read", "looks
better", or "that's what Guido has been doing for years".

> 
>     - Use spaces around arithmetic operators:
> 
>       Yes:
> 
>           i = i + 1
>           submitted += 1
>           x = x * 2 - 1
>           hypot2 = x * x + y * y
>           c = (a + b) * (a - b)
> 
>       No:
> 
>           i=i+1
>           submitted +=1
>           x = x*2 - 1
>           hypot2 = x*x + y*y
>           c = (a+b) * (a-b)
> 




More information about the Python-list mailing list