[issue42195] Inconsistent __args__ between typing.Callable and collections.abc.Callable

Ken Jin report at bugs.python.org
Mon Nov 23 02:32:35 EST 2020


Ken Jin <kenjin4096 at gmail.com> added the comment:

A possible workaround for _PosArgs in collections.abc without depending on typing could be like this:

_PosArgs = type('_PosArgs', (tuple, ), {})

This would help out the future type proposals too, because GenericAlias accepts non-type args.

__args__ of Callable in typing and collections.abc won't be == though. Because all typing types aren't equal to their builtin counterparts. Eg. Tuple[int] == tuple[int] is False.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42195>
_______________________________________


More information about the Python-bugs-list mailing list