-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Mypy doesn't let you write deque[int]
etc., but the recommended replacement (typing.Deque
) is not present in Python 3.6.0 typing:
from collections import deque
def f(x: 'deque[int]') -> None: pass # deque not subscriptable, use typing.Deque
Maybe we should allow the above example since typing.Deque
may be unavailable at runtime. Alternatively, we could modify the message to recommend using something like this:
MYPY = False
if MYPY:
from typing import Deque
....
However, the above is pretty unintuitive. TYPE_CHECKING
is not present in earlier versions of typing
so it's not always an option, but we could perhaps recommend it.
[Zulip hit this issue recently.]
Metadata
Metadata
Assignees
Labels
No labels