Guido van Rossum <gu...@python.org> added the comment:

Well, in typeshed, weakref.WeakSet and the others are generic, so you should be 
able to write

  from __future__ import annotations

  from weakref import WeakSet

  users: WeakSet[User]

Or if you need to support Python versions < 3.7, you could write

  users: 'WeakSet[User]'

Does that not solve your problem? It would be easier than adding yet another 
random class (or classes) to typing, which won't work for Python < 3.9 because 
typing.py is in the stdlib (and PEP 484 is no longer provisional).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38756>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to