From: Peng Yu on
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
From: Thomas Jollans on
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)
>

From: rantingrick on
On Jul 26, 5:20 pm, Peng Yu <pengyu...(a)gmail.com> wrote:
> This webpagehttp://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?

The rational is simple. Guido is God and if you don't follow his words
then you will be tortured. His favorite means is by forcing you to
wear Dutch wooden shoes every day whist programming Ruby! ;-)
From: Martin P. Hellwig on
On 07/27/10 00:06, rantingrick wrote:
> On Jul 26, 5:20 pm, Peng Yu<pengyu...(a)gmail.com> wrote:
>> This webpagehttp://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?
>
> The rational is simple. Guido is God and if you don't follow his words
> then you will be tortured. His favorite means is by forcing you to
> wear Dutch wooden shoes every day whist programming Ruby! ;-)

Wat is er mis met klompen?

--
mph

From: rantingrick on
> Martin wrote:
>
> Wat is er mis met klompen?

Well specifically their made from wood and wood is a very hard
substance. Also i did not go into detail but he makes sure to pick
shoes that are three sizes too small. You know a good podiatrist can
be tough to come by in these times. It's a pretty severe punishment if
you ask me.