New submission from Alexander Mohr <thehes...@gmail.com>:
For valid types which encapsulate other types, like typing.List or typing.Tuple, you can declare what's contained in them like so: foo: typing.List[int] = [] Unfortunately weakref.ReferenceType does not allow you to do this. You get the error: >>> foo: weakref.ReferenceType[typing.Any] = None Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'type' object is not subscriptable so either ReferenceType should be fixed or a new type made available. ---------- components: Library (Lib) messages: 335674 nosy: thehesiod priority: normal severity: normal status: open title: weakref.ReferenceType is not a valid typing type type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36009> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com