[issue43901] Add an empty annotations dict to all unannotated classes and modules

Guido van Rossum report at bugs.python.org
Wed Apr 21 16:26:23 EDT 2021


Guido van Rossum <guido at python.org> added the comment:

Sounds like a plan, I agree that the original design misfired here (we were probably worried about million-line code bases with tens of thousands of classes having to pay the price of tens of thousands of empty dicts, but I now think that was an unnecessary worry -- that should be a few megabytes on a very much larger total).

But given that you're not done yet:

- Is it possible to create __annotations__ lazily? (IIRC in January we came to a conclusion about this, something like yes for modules but for classes, or the other way around?)

- Why would __annotations__ ever be None? Why do you allow setting it to None? Do we know of people ever write '__annotations__ = None' in their class or write 'cls.__annotations__ = None'?

- And where's your PR?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43901>
_______________________________________


More information about the Python-bugs-list mailing list