I'm new to PyLint, and I'm glad to see a lot of warnings on my source code. Although most warnings are obvious, some warnings do not for me. For instance,
def foo(a, b): if b is not None: return a, b else: return None result = foo(a, b) if result is None: return get_something(a) value1, value2 = result
foo(a, b) return value can be either a tuple or None. After getting the return value from foo , I check if it is a valid result or not. (This is similar to checking for a NULL pointer in C / C ++). However, PyLint complains about such code; Attempting to unpack a non-sequence [W:unpacking-non-sequence] Can such warnings be avoided besides warning this warning?
source share