[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

[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

[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

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

2022-01-13 Thread Matthew Rahtz via Python-Dev
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 confirm it looks like this already works fine. So as much as I agree

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Chris Angelico
On Fri, Jan 14, 2022 at 2:12 AM Steven Troxler wrote: > > Using an operator is an interesting idea, and we should probably call it out > as an alternative in the PEP. > It's not a substitute for the current PEP from the standpoint of typing-sig > for a few reasons: > > (A) We care that the

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Steven Troxler
Using an operator is an interesting idea, and we should probably call it out as an alternative in the PEP. It's not a substitute for the current PEP from the standpoint of typing-sig for a few reasons: (A) We care that the syntax be forward-compatible with supporting named arguments, as

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Steven Troxler
Good catch, thanks Nick! It's been specified in a linked doc [0] but I forgot to move that into the PEP itself. I'll aim to get that done today. --- [0] https://docs.google.com/document/d/15nmTDA_39Lo-EULQQwdwYx_Q1IYX4dD5WPnHbFG71Lk/edit ___ Python-Dev

[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

[Python-Dev] Re: Minor inconvenience: f-string not recognized as docstring

2022-01-13 Thread Steve Holden
On Tue, Jan 11, 2022 at 6:24 PM Guido van Rossum wrote: > I personally think F-strings should not be usable as docstrings. If you > want a dynamically calculated docstring you should assign it dynamically, > not smuggle it in using a string-like expression. We don't allow "blah {x} >

[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

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Steven D'Aprano
On Thu, Jan 13, 2022 at 04:23:09AM -, Dennis Sweeney wrote: > Like others expressed, I don't like the idea of the typing and > non-typing parts of Python separating. Its a good thing that this PEP doesn't separate the typing and non-typing world. The arrow syntax will be a plain old Python

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Paul Moore
On Thu, 13 Jan 2022 at 08:48, Nick Coghlan wrote: > > The existing section on runtime behaviour in the PEP doesn't look ready for > SC consideration, since it essentially says "this hasn't been defined yet". +1. The runtime behaviour needs to be specified. Otherwise this PEP is a spec for how

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Steven D'Aprano
On Thu, Jan 13, 2022 at 06:41:14PM +1000, Nick Coghlan wrote: > If such a protocol were to be proposed, then int.__arrow__ could be defined > such that "1 -> 100" was equivalent to "range(1, 100)" Why? What's the benefit? It is slightly shorter, but no more clear than range. I would never guess

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Nick Coghlan
On Thu, 13 Jan 2022, 2:24 pm Dennis Sweeney, wrote: > Like others expressed, I don't like the idea of the typing and non-typing > parts of Python separating. > > Has anyone considered adding a new special method like `__arrow__` or > something, that would be user-definable, but also defined for

[Python-Dev] Re: PEP 677 (Callable Type Syntax): Final Call for Comments

2022-01-13 Thread Batuhan Taskaya
> Has anyone considered adding a new special method like `__arrow__` or > something, that would be user-definable, but also defined for tuples and > types as returning a Callable? For example `int -> str` could mean > Callable[[int], str], and (int, str) -> bool could mean Callable[[int, str],