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, which I clearly stated 
in the post. I don’t know the covariance thing either but I put it there 
because TypeVar function has those keyword parameters. So if we are going to 
replace TypeVar, the alternative needs to have them as well. 

The reason this might be wanted is to reduce global variables for the TypeVars 
and make them contained/local to the class and function. When I encounter 
functions or classes with those TypeVars in people codes, I have to scroll up 
to see what they represent. Several languages are opting to make the generics 
bound to the function/class, so it’s not like what I am bringing here is 
completely insane. But I understand if the syntax is not suitable for python or 
if it will add unnecessary complexity to the developers and users for little 
gain. 

Abdulla 

> On 8 Feb 2022, at 9:49 AM, Stephen J. Turnbull <stephenjturnb...@gmail.com> 
> wrote:
> 
> 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 syntax at present is required to be Python syntax.  New typing
> syntax must be introduced to Python, so this is a huge hurdle and you
> probably won't get much sympathy here, because most of us have no idea
> what you're talking about, and the syntax looks awful if you don't
> know why you'd even want it.  Even helpful discussion is going to be
> in short supply on this list (for example, I myself understand the
> definition of covariance when I read it, but I still have to look it
> up every time :-).
> 
> Your audience is really in the Typing SIG.  Happy hunting!
> 
> Steve
> 
> 
> 

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/OXBZC7GHD75GTUIBJSTP5IPVUFOYNIIO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to