New submission from Anthony Mayer:
After discussion about extraneous whitespace around colons in a list slice not
being an error on the pep8 checker project (see
https://github.com/jcrocholl/pep8/issues/321#issuecomment-53649841), ncoghlan
suggested filing a ticket here to get the issue added
Guido van Rossum added the comment:
Oooh, yes. The colon in a slice should be treated as a binary operator, with
equal space before and after.
I think we can add this (as a new bullet following the bullet Immediately
before a comma, semicolon, or colon):
- However, the colon in a slice acts
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 +,
Guido van Rossum added the comment:
Just like for other binary operators (except for the ones mentioned as always
needing spaces), the spaces around : are neither mandatory nor objectionable.
I am not making up a new rule, this is how I've always thought -- we just have
to make it explicit
Nick Coghlan added the comment:
Looks good to me! (and covers several cases that hadn't occurred to me
before)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22316
___
Guido van Rossum added the comment:
Committed rev e98737176f1d.
If there's more discussion I can add more.
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22316
Guido van Rossum added the comment:
Does anyone care that there is now one bullet in the avoid spaces ... list
that isn't strictly about avoiding spaces?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22316