PyCQA / pycodestyle

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

E226: unable to detect missing whitespace in f-string #1248

Closed yuxCai closed 2 months ago

yuxCai commented 2 months ago

pycodestyle version: 2.12.0

In the following example

num_packets_per_sec = 10
num_packets_in_one_min = num_packets_per_sec*60
print(f"Number of packets in one minute: {num_packets_per_sec*60}")

pycodestyle returns E226 missing whitespace around arithmetic operator on the second line, but not the third line. Has this been reported before?

asottile commented 2 months ago

you need to use 3.12+ for tokenization inside fstring

please search there are several duplicates