I'm very much in favour of the this concept. A few points come to mind right away:
1. Backwards Compatibility > PEP 563 changed the semantics of annotations. When its semantics are > active, annotations must assume they will be evaluated inmodule-level > scope. They may no longer refer directly to local variables or class > attributes. Given get_type_hints can be provided localns argument, this statement is not exactly true. Using localns is how I currently address scoping issues when affixing type hints. Maybe it could be argued that I'm abusing this feature, but then I would ask what the intent of localns is if not to provide additional (missing) scope during type hint evaluation? Under PEP 649, when __co_annotations__ is called (presumably by calling get_type_hints), would localns effectively be ignored? 2. __co_annotations__ scope? I'm wondering why __co_annotations__ function could not be scoped (within a closure?) such that it can access the values where the function, method, class or module are being declared? I acknowledge that I'm railing against PEP 563 again, trying to reclaim lost ground. On Mon, 2021-01-11 at 10:27 -0800, Larry Hastings wrote: > > On 1/11/21 10:16 AM, Chris Angelico wrote: > > > Number allocation is pretty informal. Go ahead and grab PEP 649; > It's now checked in as PEP 649, with a modern header, modern > copyright, and I went ahead and grabbed the formatting stanza from > the end too. > Welcome to the world, baby 649! > > /arry > _______________________________________________ > 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/OKOQEAEPKYDX6AVEFD7DDPBKOHGXB4GB/ > Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ 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/5GLDASRAWNEJXYG3Y7NDUBPPNR6TTIGX/ Code of Conduct: http://python.org/psf/codeofconduct/