[docs] [issue16239] PEP8 arithmetic operator examples
Ezio Melotti
report at bugs.python.org
Thu Oct 25 19:20:17 CEST 2012
Ezio Melotti added the comment:
Attached a patch that modifies some of the example in the section.
- x = x * 2 - 1
- hypot2 = x * x + y * y
+ x = x*2 - 1
+ hypot2 = x*x + y*y
Here I used more space around operators with lower priority.
- x = x*2 - 1
- hypot2 = x*x + y*y
- c = (a+b) * (a-b)
+ x = x * 2-1
+ hypot2 = x*x + y * y
+ c = a+b * a-b
These 3 examples in the "No" section show respectively:
1) more space around the operator with higher priority;
2) inconsistent spacing around operators with the same priority;
3) misleading spacing (similar to 1);
I don't think it's necessary to mention 'x * 2 - 1' in either sections, because it's not wrong, but otoh 'x*2 - 1' is a better alternative.
----------
assignee: docs at python -> ezio.melotti
keywords: +patch
nosy: +ezio.melotti
stage: -> patch review
Added file: http://bugs.python.org/file27713/issue16239.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16239>
_______________________________________
More information about the docs
mailing list