New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:

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(): return 1

>>> f.__annotations__
{}
>>> g.__annotations__
{}
>>> hex(id(f.__annotations__))
'0x109207e40'
>>> hex(id(g.__annotations__))
'0x1092296c0'

----------
components: Interpreter Core
messages: 350490
nosy: rhettinger
priority: low
severity: normal
status: open
title: Create empty __annotations__ dictionaries lazily
type: performance
versions: Python 3.9

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

Reply via email to