Black: Incorrectly adding space in slice

Created on 13 Sep 2020  路  2Comments  路  Source: psf/black

I have a simple one liner that replaces the characters at the beginning of a string with a different (shorter) string.
To achieve this I do a slice of the second string using a len call on the first string.

string2 = string1 + string2[len(string1):]

black incorrectly adds a space into the slice, like so

string2 = string1 + string2[len(string1) :]

PyCharm then highlights this as incorrect (PEP8: E203 whitespace before ':').

I'm using blackd server, version 20.8b1.

duplicate not a bug

Most helpful comment

Also a duplicate of #1541, #1448, #1437, #1413, #1343, #1332, #1323, #1029, #889, #785, #565, #544, #492, #403, #354, #350, #311, #279, #264, and #227...

contemplating why I decided to become a triager for Black

Anyway, please disable flake8's E203 as it is not PEP 8 compliant.

All 2 comments

Also a duplicate of #1541, #1448, #1437, #1413, #1343, #1332, #1323, #1029, #889, #785, #565, #544, #492, #403, #354, #350, #311, #279, #264, and #227...

contemplating why I decided to become a triager for Black

Anyway, please disable flake8's E203 as it is not PEP 8 compliant.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mhham picture mhham  路  22Comments

odormond picture odormond  路  21Comments

Kristinita picture Kristinita  路  28Comments

lig picture lig  路  84Comments

Lukas0907 picture Lukas0907  路  66Comments