python styles: why Use spaces around arithmetic operators?

Peng Yu pengyu.ut at gmail.com
Mon Jul 26 18:20:09 EDT 2010


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?

    - 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)

-- 
Regards,
Peng



More information about the Python-list mailing list