See https://discuss.lgtm.com/t/python-false-positive-the-iter-method-of-iterable-class-xxx-does-not-return-an-iterator/2116
In the case where __iter__ returns an instance of a class that partially implements an iterator (e.g. implements __next__ but not __iter__), then the alert location and message can be confusing, as the problem actually lies with the definition of the iterator, and not the use of it.
As a suggested improvement, when returning an instance of a class that implements __next__ but not __iter__, the alert location should instead be the iterator class, and the message something like "This class is returned as an iterator {here}, but is missing a definition for __next__, so does not fully implement the iterator interface."
See https://discuss.lgtm.com/t/python-false-positive-the-iter-method-of-iterable-class-xxx-does-not-return-an-iterator/2116
In the case where
__iter__returns an instance of a class that partially implements an iterator (e.g. implements__next__but not__iter__), then the alert location and message can be confusing, as the problem actually lies with the definition of the iterator, and not the use of it.As a suggested improvement, when returning an instance of a class that implements
__next__but not__iter__, the alert location should instead be the iterator class, and the message something like "This class is returned as an iterator {here}, but is missing a definition for__next__, so does not fully implement the iterator interface."