-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
R: duplicateThis issue or pull request already existsThis issue or pull request already existsR: not a bugThis is deliberate behavior of Black.This is deliberate behavior of Black.
Description
Describe the bug
Black adds a space before the colon in a string slice with no upper bound
To Reproduce
a = "foo"
b = a[len(a) - 2:]
when run on black with no arguments produces
a = "foo"
b = a[len(a) - 2 :]
Expected behavior A clear and concise description of what you expected to happen.
The correct behavior would be to output
a = "foo"
b = a[len(a) - 2:]
Environment (please complete the following information):
- Version: 20.8b1
- OS and Python version: Linux/Python 3.8.1
Does this bug also happen on master? To answer this, you have two options:
Yes
Additional context Add any other context about the problem here.
flake8 and PyCharm both report "E203 whitespace before ':'" with Black's current output
The correct behavior is inferred from this example from the pep8 document ham[1:9:]
I'm currently working around this with # fmt: off since our files have to pass flake8.
micknudsen
Metadata
Metadata
Assignees
Labels
R: duplicateThis issue or pull request already existsThis issue or pull request already existsR: not a bugThis is deliberate behavior of Black.This is deliberate behavior of Black.