Open StephenWattam opened 7 years ago
arr = None if arr and arr[0]: print("Never reached")
************* Module test E: 3,11: Value 'arr' is unsubscriptable (unsubscriptable-object)
No warning, or a warning about using this pattern at all. Maybe a warning about unreachable code in cases like this where arr is known to be falsy.
arr
pylint 1.6.4, astroid 1.4.9 Python 3.6.0 (default, Jan 16 2017, 12:12:55) [GCC 6.3.1 20170109]
Unfortunately, pylint doesn't understand control flow yet, so it can't tell that the arr[0] isn't reached. These sorts of issues should be addressed after version 2.0 is released.
arr[0]
Steps to reproduce
Current behavior
Expected behavior
No warning, or a warning about using this pattern at all. Maybe a warning about unreachable code in cases like this where
arr
is known to be falsy.pylint --version output