[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
On Sat, Nov 28, 2020 at 10:22 PM Abdulla Al Kathiri < alkathiri.abdu...@gmail.com> wrote: > Indeed. Shantanu did some quick counting and found that after 'Any' and > the types covered by PEP 585, Callable is by far the most used: > https://bugs.python.org/issue42102#msg381155 > > > Nice survey. C

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread David Foster
On 11/28/20 9:31 AM, Guido van Rossum wrote: > I'm not so keen on the square brackets you propose. How about we write > Callable[[x, y], z] as (x, y) -> z instead? I also like the "(x, y) -> z" syntax a bit better than "[x, y -> z]". (+0.5) On 11/28/20 3:46 PM, Guido van Rossum wrote: > You cou

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Abdulla Al Kathiri
> On Nov 29, 2020, at 3:46 AM, Guido van Rossum wrote: > > You could parenthesize the return value if you think it's not clear Yeah I agree. Parenthesizing the return should be optional because if we require it, the callable arguments with parenthesized returns and the parenthesized return o

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
On Sat, Nov 28, 2020 at 9:32 AM Andrew Svetlov wrote: > I would see support of all argument kinds support in any proposal for a > new callable: positional only args, named args, keyword-only, *args and > **kwargs. > The exact notation in probably less important than missing functionality. > Hm,

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Guido van Rossum
On Sat, Nov 28, 2020 at 10:02 AM Abdulla Al Kathiri < alkathiri.abdu...@gmail.com> wrote: > Initially, when I wrote this, I had a similar syntax to what you wrote. I > like it, I changed it to brackets so we could contain Callable that has > multiple arguments or return value as Callables themselv

[Python-ideas] Re: Alternative to Callable Annotation

2020-11-28 Thread Abdulla Al Kathiri
Initially, when I wrote this, I had a similar syntax to what you wrote. I like it, I changed it to brackets so we could contain Callable that has multiple arguments or return value as Callables themselves. E.g., function that has two Callables as arguments and a Callable return looks like this