Consider the following code using debug-expressions in f-strings. Here's the PEP that seeks to retroactively codify them and gives some links to their description.
var = 123
print(f"{var=}")
print(f"{var = }")
It produces the following output:
var=123
var = 123
As one can see, the spaces around the "=" sign are not a code formatting choice, but rather a part of the debug format. Hence, pycodestyle should probably ignore them. However, it currently thinks that it's a formatting error:
mre.py:3:13: E251 unexpected spaces around keyword / parameter equals
mre.py:3:15: E202 whitespace before '}'
mre.py:3:15: E251 unexpected spaces around keyword / parameter equals
I am extensively using these expressions in many projects and having to manually ignore E202 and E251 every time is a bit of a hassle!
Consider the following code using debug-expressions in f-strings. Here's the PEP that seeks to retroactively codify them and gives some links to their description.
It produces the following output:
As one can see, the spaces around the "=" sign are not a code formatting choice, but rather a part of the debug format. Hence, pycodestyle should probably ignore them. However, it currently thinks that it's a formatting error:
I am extensively using these expressions in many projects and having to manually ignore E202 and E251 every time is a bit of a hassle!