PyCQA / pycodestyle

Simple Python style checker in one Python file
https://pycodestyle.pycqa.org
Other
5.05k stars 751 forks source link

reporting incorrect information in format strings #1229

Closed beauxq closed 9 months ago

beauxq commented 9 months ago
a = 2
print(f"{a = }")

This reporting an error E251 about "keyword / parameter" when there is no "keyword / parameter" here.

This is not a style choice. The E202 reported is also not a style choice. This is a different value that makes a different program with different behavior.

a = 2
print(f"{a=}")
>>> f"{a=}" == f"{a = }"
False

This usage is in the python documentation. https://docs.python.org/3/reference/lexical_analysis.html#f-strings

asottile commented 9 months ago

please search for duplicates next time