[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-18 Thread Glenn Linderman
On 1/18/2022 2:35 PM, Jim J. Jewett wrote: The problem is that [*s3, *s4] = (a, b, 1, 2, 3) is ambiguous ... It wouldn't have to be... but as you say, it needs to be explicit. *s3 could get all the content, and *s4 a tuple with no members. ___ Py

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-18 Thread Jim J. Jewett
I'm seeing enough different interpretations to think things aren't quite specified -- but I'm not sure if it matters. (1) Is any of this something that should affect computation, or is it really just a question of how to interpret possibly ambiguous documentation? (2) Are any of these troubl

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-14 Thread Matthew Rahtz via Python-Dev
*First point (indexing assignment)* [Guido] > Agreed. I just misremembered this, my bad! Please do the clarification etc. Will do. *Second point (multiple TypeVarTuples)* [Guido] > I would love it for the cases where it's *not* ambiguous to just work (once type checkers support it). I'd like t

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-14 Thread Kevin Millikin via Python-Dev
Yes, exactly. Specifically, the "wrong" example in section 'Multiple Type Variable Tuples: Not Allowed' suggests that maybe what is wrong is that `Generic` was given more than one unpacked type variable tuple. The actual problem is a consequence of that: `class Array` has more than one type varia

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-14 Thread Matthew Rahtz via Python-Dev
[Matthew] > 1. The wording of the 'Multiple Type Variable Tuples: Not Allowed' section - you're saying that we're being a bit imprecise here in saying that we disallow multiple TypeVarTuples in a type parameter list, given that in e.g. `def f(x: *Ts1, y: *Ts2)`, both Ts1 and Ts2 are members of the

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-13 Thread Matthew Rahtz via Python-Dev
Thanks also Kevin for this feedback! Good point about being careful to distinguish type parameters vs type arguments. If I understand correctly, you're making two points: 1. The wording of the 'Multiple Type Variable Tuples: Not Allowed' section - you're saying that we're being a bit imprecise he

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-13 Thread Guido van Rossum
On Thu, Jan 13, 2022 at 8:18 AM Matthew Rahtz wrote: > Thanks also Kevin for this feedback! > > Good point about being careful to distinguish type parameters vs type > arguments. If I understand correctly, you're making two points: > > 1. The wording of the 'Multiple Type Variable Tuples: Not All

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-13 Thread Guido van Rossum
On Thu, Jan 13, 2022 at 7:23 AM Matthew Rahtz wrote: > Thanks for this feedback, Petr! > > *First point (indexing assignment)* > > Great catch; we hadn't thought about this. I agree it would be better to > keep these in sync. > > I just tested this in our current CPython implementation, and can c

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-13 Thread Kevin Millikin via Python-Dev
The wording there probably should be improved. I had a different interpretation when I read that, so that suggests it needs to be clarified. We should ensure to draw a clear distinction between type parameters and type arguments. (Generic classes and functions are parameterized over type paramet

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-13 Thread Petr Viktorin
On 12. 01. 22 17:58, Guido van Rossum wrote: On Wed, Jan 12, 2022 at 4:57 AM Petr Viktorin > wrote: Matthew Rahtz wrote: > Hi everyone, > > We've got to the stage now with PEP 646 that we're feeling pretty happy > with it. So far though we'

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-12 Thread Guido van Rossum
On Wed, Jan 12, 2022 at 4:57 AM Petr Viktorin wrote: > Matthew Rahtz wrote: > > Hi everyone, > > > > We've got to the stage now with PEP 646 that we're feeling pretty happy > > with it. So far though we've mainly been workshopping it in typing-sig, > so > > as PEP 1 requires we're asking for some

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2022-01-12 Thread Petr Viktorin
Matthew Rahtz wrote: Hi everyone, We've got to the stage now with PEP 646 that we're feeling pretty happy with it. So far though we've mainly been workshopping it in typing-sig, so as PEP 1 requires we're asking for some feedback here too before submitting it to the steering council. If you hav

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2021-09-09 Thread bas van beek
Hi all, I very much share Stephan's opinion here and look forward to integrating the new PEP 646 variadics into numpy. In the context of numpy (and tensor typing general): the typing of array shapes is a fairly complicated subject and the introduction of variadics will likely play in big role i

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2021-08-09 Thread Dan Moldovan via Python-Dev
I'd be interested in using this the mechanisms defined in this PEP to define rank-generic Tensor types in TensorFlow, which are important in specifying `tf.function` signatures in a Pythonic way, using type annotations (rather than the custom `input_signature` mechanism we have today - see this

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2021-08-06 Thread Dan Moldovan via Python-Dev
I'd be interested in using this the mechanisms defined in this PEP to define rank-generic Tensor types in TensorFlow, which are important in specifying `tf.function` signatures in a Pythonic way, using type annotations (rather than the custom input_signature mechanism we have today - see this issue

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2021-07-09 Thread Matthew Rahtz via Python-Dev
Still working on it :) Specifically the grammar changes in cpython, though I haven't found much time to work on it recently. Tune into the tensor typing meeting on Monday for a more detailed update. On Thu, 8 Jul 2021 at 19:49, Filipe Laíns wrote: > On Sat, 2021-03-20 at 14:08 +, Matthew Rah

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2021-07-08 Thread Filipe Laíns
On Sat, 2021-03-20 at 14:08 +, Matthew Rahtz via Python-Dev wrote: > Hi everyone, > We've got to the stage now with PEP 646 that we're feeling pretty happy with > it. So far though we've mainly been workshopping it in typing-sig, so as PEP 1 > requires we're asking for some feedback here too be

[Python-Dev] Re: PEP 646 (Variadic Generics): final call for comments

2021-04-06 Thread Stephan Hoyer
I just wanted to thank Matthew & Pradeep for writing this PEP and for clarifications to the broader context of PEP 646 for array typing in https://github.com/python/peps/pull/1904. As someone who is heavily involved in the Python numerical computing community (e.g., NumPy, JAX, Xarray), but who is