You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optional NumPy array not narrowed in max key #16416
Here's an example where I'm allowed to index a NumPy array after narrowing its otherwise optional type when I do so directly, but not when I use it as part of a key for max .
I wouldn't have expected a[x] to be problematic, since we know a is not None at this point. MyPy itself seems to be aware since the preceding line, containing an a[0], does not cause any errors.
Actual Behavior
main.py:11: error: Value of type "Any | None" is not indexable [index]
Your Environment
Mypy version used: 1.6.1
Mypy command-line flags: None.
Mypy configuration options from mypy.ini (and other config files): None
Activity
hauntsaninja commentedon Nov 6, 2023
Thanks, this is fixed on master in #16407