Batuhan Taskaya <isidenti...@gmail.com> added the comment:

> For instance, we have such code:

But what about this, what would the bytecode will look like in this case (where 
the annotations don't exactly follow each other?)

a: int
T = TypeVar('T')
b: T
b1: Gen[T]
X = TypeVar('X')
c: X
d: str

Do you propose to build 2/3 different dicts and apply them one by one to allow 
calls to access that frame and recover the annotations?

> I will look more like micro-optimization, I can implement this feature and 
> run benchmarks to check performance boost.

What kind of optimization do you target? It would be really cool if you could 
get us some numbers with a draft patch (like comparing to test the import time 
of a module heavy with annotations, or even maybe some real-world examples. 
Here is a list of heavily-typed projects: 
https://github.com/hauntsaninja/mypy_primer/blob/2d14b20fa782896cc3d6ad2548a70c024b0f4e8a/mypy_primer.py#L900

Would love to see an import time comparison, or something similiar.

----------

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

Reply via email to