False positive unnecessary-dict-index-lookup
and consider-using-dict-items
if value associated with key is changed in loop
#4630
Labels
False Positive 🦟
A message is emitted but nothing is wrong with the code
Milestone
Steps to reproduce
Given a file
d.py
:Current behavior
Result of
pylint d.py
:Expected behavior
No diagnostics.
Following the recommendation for line 9 (i.e., rewriting
d[k]
to_
) would incorrectly change the semantics of the program, asd[k]
has already been changed, so it has a different value than_
.Following the recommendation for line 14 (i.e., rewriting
for k in d
tofor k, v in d.items()
would lead back to the above problem.pylint --version output
Result of
pylint --version
output:The text was updated successfully, but these errors were encountered: