'Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty'
Used when Pylint detects that len(sequence) is being used without explicit comparison inside a condition to determine if a sequence is empty. Instead of coercing the length to a boolean, either rely on the fact that empty sequences are false or compare the length against a scalar.
def example(): items =  if len(items): pass
3:7: C1801: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty
len(items) as a boolean makes the code unobvious. If
items is empty,
length will be zero which coerces to
False. Just using
items as the
condition achieves the same and is - especially when you have good names -
easier to read and understand.
def example(): items =  if items: pass
No issues found.