[New-bugs-announce] [issue36009] weakref.ReferenceType is not a valid typing type
Alexander Mohr
report at bugs.python.org
Sat Feb 16 03:04:16 EST 2019
New submission from Alexander Mohr <thehesiod at 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 <report at bugs.python.org>
<https://bugs.python.org/issue36009>
_______________________________________
More information about the New-bugs-announce
mailing list