[Python-ideas] Re: Generics alternative syntax

2022-02-07 Thread Abdulla Al Kathiri
I thought this is called python-ideas, meaning it’s ok to bring ideas even if they are ugly or stupid. No need to introduce it in Python if it’s too much but it might induce discussions. I am not per se convinced of the syntax I wrote. Any suggestion to make it better is more than welcomed,

[Python-ideas] Generics alternative syntax

2022-02-07 Thread Stephen J. Turnbull
Abdulla Al Kathiri writes: > Sorry to bother you again with the generic thing. > Golang will soon release a new version with Generics. I like their > way of doing it. Like Rust, they don’t bother with TypeVars. It > makes you wonder why we are not doing something similar in Python. Typing

[Python-ideas] Generics alternative syntax

2022-02-07 Thread Abdulla Al Kathiri
Hello all, Sorry to bother you again with the generic thing. Golang will soon release a new version with Generics. I like their way of doing it. Like Rust, they don’t bother with TypeVars. It makes you wonder why we are not doing something similar in Python. [T: Type] ——> T is invariant and

[Python-ideas] Consider moving abstract method checking logic from ABCMeta into object

2022-02-07 Thread Neil Girdhar
Currently, some type checkers rightly complain that a method is decorated with abc.abstractmethod when the class's type does not inherit from ABCMeta. Adding a metaclass is a fairly heavy dependency since you're forced to poison all of your other metaclasses with the same base metaclass. It

[Python-ideas] Re: Mapping unpacking assignment

2022-02-07 Thread Eric V. Smith
> On Feb 7, 2022, at 1:55 AM, Chris Angelico wrote: > … > def spam(): >bird = "Norwegian Blue" >volts = 4e6 >return "{volts}V insufficient to voom {bird}".format(**locals()) This is completely off topic, but: the better way to do this is with .format_map(locals()). This public

[Python-ideas] Re: Mapping unpacking assignment

2022-02-07 Thread Chris Angelico
On Tue, 8 Feb 2022 at 01:27, Eric V. Smith wrote: > > > > On Feb 7, 2022, at 1:55 AM, Chris Angelico wrote: > > > … > > def spam(): > >bird = "Norwegian Blue" > >volts = 4e6 > >return "{volts}V insufficient to voom {bird}".format(**locals()) > > This is completely off topic, but: the