[issue37949] Create empty __annotations__ dictionaries lazily

2019-08-26 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue37949] Create empty __annotations__ dictionaries lazily

2019-08-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Guido's Time Machine strikes back. >>> import gc >>> def f(): pass ... >>> gc.get_referents(f) [", line 1>, {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , 'gc': ,

[issue37949] Create empty __annotations__ dictionaries lazily

2019-08-25 Thread Raymond Hettinger
New submission from Raymond Hettinger : Right now, every heap function is given a new annotations dictionary even if annotations aren't used. How about we create these lazily in order to speed-up function creation time, improve start-up time, and save space. >>> def f(): pass >>> def g():