pylint-errors

E0303 (invalid-length-returned)

:x: Problematic code:

class Foo:
    def __len__(self):
        return -1

:heavy_check_mark: Correct code:

class Foo:
    def __len__(self):
        return 0  # n >= 0

Rationale:

Used when a __len__ method returns something which is not a non-negative integer.