False positive E1126 when index previously assigned to None #2880
Labels
Bug 🪲
Control flow
Requires control flow understanding
Minor 💅
Polishing pylint is always nice
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
The following code:
gives:
I can see that this is because j was initially set to
None
, which would not be a valid index. However the code is actually correct, as a human can see, since it checks forNone
before using the index.I'm not sure if there's anything pylint can do abut this, since I'm not sure how sophisticated it aims to be in checking this sort of thing. But reporting this anyway for what it's worth - feel free to close if this is outside the scope of pylint.
The text was updated successfully, but these errors were encountered: