[docs] [issue22316] Add rule about "extraneous whitespace around colon" to "Whitespace In Expressions and Statements" of PEP8

Ezio Melotti report at bugs.python.org
Sun Aug 31 23:28:04 CEST 2014

Ezio Melotti added the comment:

> Yes: ham[lower + offset : upper + offset], ham[lower : upper : 3]

This feels a bit weird to me, perhaps because I seldom have expressions in slices and don't feel the need to add further spaces.
For the first case I would definitely not put spaces around the +, and likely not even around the :.
For the second case I also wouldn't put spaces around the :.
In general complex expressions that requires additional spaces around the : to better separate start, stop, and step should be avoided or, if really necessary, additional variables should be used*.
I would be -0.5 if this is kept but with a "Maybe" instead of the "Yes", -0 if the spaces around the + are removed.

* note that I'm not too familiar with bumpy/scipy, where I believe complex slice expressions might be more common.

nosy: +ezio.melotti

Python tracker <report at bugs.python.org>

More information about the docs mailing list