Pylint not-an-iterable on a list

Viewed 52

I am getting this warning:

Non-iterable value ls is used in an iterating context Pylint(E1133:not-an-iterable)

From:

def find(ls: list[str], value: str, ignore_case: bool = False) -> bool:
    """
    Find method for search an element in a list.
    """
    if ignore_case:
        for s in ls:
            if s.lower() == value.lower():
                return True
        
        return False

    for s in ls:
        if s == value:
            return True
    
    return False

Details:

Python 3.9.13

Why?

0 Answers
Related