Yeah I like <> because def f<T>(…) is easier to the eyes to parse than def 
f[T](…) but in python we use [] for the types so it might not be consistent. 

Why can’t we attach the TypeVar as a class and function attributes? 

Abdulla 

Sent from my iPhone

> On 8 Feb 2022, at 1:02 PM, Jonathan Slenders <jonat...@slenders.be> wrote:
> 
> Personally, I very much like this approach, although I'd definitely prefer <> 
> brackets instead, like in other languages.
> 
> We could possibly think of it as being syntactic sugar for the current 
> TypeVar approach, and have it translated into TypeVars at runtime.
> 
> However, if we'd define it that way, then these type variables would still 
> end up in the global scope.
> We don't have scopes at the class/function definition level. That would mean 
> that we can't reuse the same symbol for separate functions, unless the types 
> are identical.
_______________________________________________
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/PW45573J3OHXA652PVX7U3LMDE67V5OD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to