Ken Jin <kenjin4...@gmail.com> added the comment:
> Type expression is coerced to a list of parameter arguments in substitution > of ParamSpec. It's not, only the repr is like that. Internally it's not coerced. >>> C[int, str] typing.Callable[[int], str] >>> C[int, str].__args__ (<class 'int'>, <class 'str'>) Because Callable's correct form is Callable[[type], type] (where type is not ParamSpec or Concatenate) so the repr reflects that. Internally, Callable also flattens the list of args: >>> Callable[[int, str], int].__args__ (<class 'int'>, <class 'str'>, <class 'int'>) Because __args__ *must* be hashable and immutable. Otherwise, it will not work with Union or Literal. Some time ago we tried converting to nested tuple. But that was too difficult (and backwards incompatible) because every other typing operation expected __args__ to contain types, not a tuple. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44801> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com