On Sun, 2021-04-11 at 23:34 -0700, Larry Hastings wrote: > Your example was valid, and I think your workaround should be fine. > Do you have a use case for this, or is this question motivated purely > by curiosity?
It took a few readings for me to understand the limitations in the PEP. My example and workaround were mostly for me to confirm I had read it correctly. > It's fine to modify the __annotations__ dict after the creation of > the class or module. It's code that modifies "__annotations__" from > within the class or module that is disallowed here. Similarly for > dataclasses; once it creates a class object, it can explicitly set > and / or modify the annotations dict on that class. Thanks. I think this clarification should be added to the PEP. Paul
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/6OTLAO3XOO2DVAGJOL4Q4LKPLCMLI3FZ/ Code of Conduct: http://python.org/psf/codeofconduct/