Dong-hee Na <donghee.n...@gmail.com> added the comment:

> Do you have any realistic example which would benefit from speeding up the 
> creation of GenericAlias instances?

Hmm I did not find loop tightly calling case, but
for example, this kinds of usage are very often.

def create_q(l: list[int]) -> Queue[int]:
    q = Queue[int]()
    for e in l:
        q.put(e)
    return q

a = create_q([1,2,3,4,5])

In this code, GenericAlias is called 2 times for function declare and function 
call.

It's true that GenericAlias ​​has a small portion in this scenario,
but wouldn't it be worth it if we could optimize itself to a few lines of code?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40369>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to