[issue40494] collections.abc.Callable and type variables

2020-12-25 Thread Guido van Rossum
Guido van Rossum added the comment: Indeed. Thanks! -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue40494] collections.abc.Callable and type variables

2020-12-25 Thread Ken Jin
Ken Jin added the comment: Now that issue42195 has been resolved by subclassing types.GenericAlias, can this be closed? On 3.9 and 3.10: >>> import typing, collections.abc >>> T = typing.TypeVar('T') >>> C2 = collections.abc.Callable[[T], T] >>> C2[int] collections.abc.Callable[[int], int]

[issue40494] collections.abc.Callable and type variables

2020-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: >From https://bugs.python.org/issue42195 it looks like we need to create a >subclass just for Callable. See https://bugs.python.org/issue42102 and PR >22848. -- ___ Python tracker

[issue40494] collections.abc.Callable and type variables

2020-05-06 Thread Guido van Rossum
Guido van Rossum added the comment: Hm, I am indeed torn. ISTM a subclass just for Callable is slightly better. -- ___ Python tracker ___

[issue40494] collections.abc.Callable and type variables

2020-05-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Of course. There is more than one way to fix it: * Make GenericAlias substituting type variables in list. It is easier and it will fix this particular case, but there will be subtle differences in __args__. * Add a GenericAlias subclass with overridden

[issue40494] collections.abc.Callable and type variables

2020-05-04 Thread Guido van Rossum
Guido van Rossum added the comment: Yeah, the fix will require a variant of types.GenericAlias that substitute's type variables in lists. -- ___ Python tracker ___

[issue40494] collections.abc.Callable and type variables

2020-05-04 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Here I think the behavior of typing.Callable is correct. -- ___ Python tracker ___ ___

[issue40494] collections.abc.Callable and type variables

2020-05-04 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : There is a difference between typing.Callable and collections.abc.Callable. >>> import typing, collections.abc >>> T = typing.TypeVar('T') >>> C1 = typing.Callable[[T], T] >>> C2 = collections.abc.Callable[[T], T] >>> C1 typing.Callable[[~T], ~T] >>> C2