Pekka Klärck <pekka.kla...@gmail.com> added the comment:

You are obviously right with how `__instancecheck__` and `__subclasscheck__` 
work. We'd either need something like `__rinstancecheck__` and 
`__rsubclasscheck__` or `isinstance` and `issubclass` needed to handle this 
using `types.resolve_bases`, `__origin__`, or something else.

It's unfortunate that `__origin__` cannot be considered to be part of the 
stable API and that no other suitable API exists. I don't want to add an 
external dependency only to handle this situation, so I guess I'll just use 
`__origin__` with Python 3.7+. Hopefully it isn't changed in 3.7 minor versions 
and hopefully a public API exists in 3.8.

----------

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

Reply via email to