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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=<Date2018-12-02.16:18:57.270>created_at=<Date2018-11-28.17:17:38.210>labels= ['3.7', '3.8', 'type-feature', 'library']
title='Add generic version of OrderedDict to typing module'updated_at=<Date2018-12-02.16:18:57.269>user='https://github.com/itoijala'
The other collections from the collections module (namedtuple, deque, ChainMap, Counter, defaultdict) have generic versions in the typing module for use in type annotations.
The problem is currently the following:
from __future__ importannotationsimporttypingfromcollectionsimportOrderedDict# Understood by mypydeff(d: OrderedDict[str, str]) ->None:
Traceback (most recent call last):
File "foo.py", line 9, in <module>
File "/usr/lib/python3.7/typing.py", line 1001, in get_type_hints
value = _eval_type(value, globalns, localns)
File "/usr/lib/python3.7/typing.py", line 260, in _eval_typereturn t._evaluate(globalns, localns)
File "/usr/lib/python3.7/typing.py", line 464, in _evaluateeval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>TypeError: 'type' object is not subscriptable
To fix this, a line like the following could be added to Lib/typing.py near line 1250: