invalid-length-hint-returned / E0310ΒΆ
Message emitted:
__length_hint__ does not return non-negative integer
Description:
Used when a __length_hint__ method returns something which is not a non-negative integer
Problematic code:
class CustomLengthHint:
"""__length_hint__ returns non-int"""
def __length_hint__(self): # [invalid-length-hint-returned]
return 3.0
Correct code:
class CustomLengthHint:
"""__length_hint__ returns <type 'int'>"""
def __length_hint__(self):
return 10
Created by the classes checker.