Ken Jin <kenjin4...@gmail.com> added the comment:
Should Concatenate support substitution to begin with? PEP 612 doesn't say anything, and I am fairly certain it's a special typing form, not a generic. So I don't really understand what it means to substitute Concatenate. Then again, Callable with a nested Concatenate can be substituted, and we currently implement that by using Concatenate's substitution behavior as proxy. But again, the meaning isn't clear to me. I also noticed this strange part in PEP 612 about user-defined generic classes: "`Generic[P]` makes a class generic on `parameters_expressions` (when P is a ParamSpec)": ... class X(Generic[T, P]): f: Callable[P, int] x: T def f(x: X[int, Concatenate[int, P_2]]) -> str: ... # Accepted (KJ: What?) ... The grammar for `parameters_expression` is: parameters_expression ::= | "..." | "[" [ type_expression ("," type_expression)* ] "]" | parameter_specification_variable | concatenate "[" type_expression ("," type_expression)* "," parameter_specification_variable "]" I'm very confused. Does this mean Concatenate is valid when substituting user generics? Maybe I should ask the PEP authors? My general sense when I implemented the PEP was that it was intended primarily for static type checking only. IMO, runtime correctness wasn't its concern. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44791> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com