unnecessary-list-index-lookup
false-positive when iterable is modified in loop
#6896
Labels
False Positive 🦟
A message is emitted but nothing is wrong with the code
Bug description
With some code like this:
(real-world example), pylint claims that
parts[i]
could be replaced bypart
- but as running the file shows, that isn't actually the case:You might think that this is a bit unorthodox (and I might agree, should probably rewrite this...), but if I'm reading the Python docs right, the behavior is well-defined (emphasis mine):
cc @timmartin who added the checker in #5834.
Configuration
No response
Command used
Pylint output
Expected behavior
No error
Pylint version
OS / Environment
Archlinux
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: