unnecessary-list-index-lookup is falsely being reported when there is a start index #7682
Labels
False Positive 🦟
A message is emitted but nothing is wrong with the code
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Milestone
Bug description
The code is:
Which produces the output:
[(1, 2), (2, 3), (3, 4), (4, 5)]
When there is a start parameter on the enumeration, "item" and "series[index]" are not the same object
but pylint suggests:
R1736: Unnecessary list index lookup, use 'item' instead (unnecessary-list-index-lookup)
If we follow the advice we would get a different result set
[(1, 1), (2, 2), (3, 3), (4, 4)]
I think the error should be suppressed when there's a start index on the enumeration
Configuration
No response
Command used
pylint .\pylint.py
Pylint output
Expected behavior
No error at all
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: