Hello, This is a great PEP. It turns out to be applicable in a variety of scenarios.
Case in point: Matthew Rahtz and I are working on PEP 646: Variadic Generics (https://www.python.org/dev/peps/pep-0646/; discussion on typing-sig). It is a type system feature that allows specifying an arbitrary tuple of type variables instead of a single type variable. We plan to use your proposed syntax to represent unpacking a tuple type. This would be analogous to `*` for unpacking a tuple value: + `Tensor[int, *Ts, str]` and `Tensor[*Ts1, *Ts2]` + such variadic classes would be declared as `class Tensor(Generic[T, *Ts, T2]):` Questions: 1. Does PEP 637 support unpacking multiple `*` arguments? - e.g., Tensor[int, *Ts, str, *Ts2] 2. Does PEP 637 allow a positional argument after a `*`? - e.g., Generic[T, *Ts, T2] PEP 637 says "Sequence unpacking is allowed inside subscripts", so it looks like these should be allowed (just as in function calls). But I wanted to confirm it explicitly since this is our core use case and there was no example with multiple sequences being unpacked. 3. We also wanted to ask - how's your implementation going? We'll be starting implementation in typing.py soon. Since there's some overlap we wanted to make sure we're not duplicating your work, and that there won't be any merge conflicts later. Do you have a fork we might be able to get early access to? We're also targeting the 3.10 release for our implementation. I'd be happy to provide additional details if needed. Best, Pradeep Kumar Srinivasan Matthew Rahtz _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/IPPW3Z5NHQ7YRXESPTF64PPAX7CDQGCG/ Code of Conduct: http://python.org/psf/codeofconduct/
