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
from typing import List, Tuple
l: List[Tuple[int, str]] = []
v = max(l, key=lambda item: item[0], default=None)
reveal_type(v)
mypy complains about the item[0] usage in the key function:
Value of type "Optional[Tuple[int, str]]" is not indexable
Revealed type is 'Union[Tuple[builtins.int, builtins.str], None]'
Also interesting that it shows two different representations for the inferred type.
For user ergonomics the revealed type should be 'Optional[Tuple[int, str]]' as well, no?