Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

There are two ways to fix the larger issue.

1. Make issubclass(types.GenericAlias, type) returning True, and also make 
isinstance(typing.List[int], type) returning True and 
issubclass(typing._GenericAlias, type) returning True, and analyze every place 
in the interpreter and the stdlib which calls isinstance(..., type) or 
issubclass(..., type) and ensure that they work with types.GenericAlias and 
typing._GenericAlias and their instances as well as with ordinary types, fix 
them and add tests for them. And perhaps do the same for types.UnionType, 
typing._UnionGenericAlias, typing.TypeVar, typing.NewType, etc, etc.

2. Make isinstance(list[int], type) returning False. It would be nice to ad 
also tests for the same cases as in option 1, but it is not so urgent, and I 
expect that in most cases the current behavior which matches the status quo is 
expected.

I tried to implement option 1, but it is just too much places, so it would take 
a large amount of time which I do not have right now. First than invest my time 
in this I want to make sure which option is desirable in long term.

Guido, Ivan, Ken Jin, what would you say?

----------

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

Reply via email to