Oh, I agree it shouldn’t reference the typing module. But it should not raise NameError. This whole thing already is a special case. We can debate what else it should, e.g. skip the name, return a fixed error token, return an error token that includes the name that failed (this is part if the NameError), return a string, etc…
FWIW the “tiny” change to decorator syntax looks untenable. On Tue, Aug 10, 2021 at 23:09 Larry Hastings <la...@hastings.org> wrote: > On 8/10/21 11:15 AM, Thomas Grainger wrote: > > Although the co_annoations code could intercept the NameError and replace > return a ForwardRef object instead of the resolved name > > > No, it should raise a NameError, just like any other Python code. > Annotations aren't special enough to break the rules. > > I worry about Python-the-language enshrining design choices made by the > typing module. Python is now on its fourth string interpolation > technology, and it ships with three command-line argument parsing > libraries; in each of these cases, we were adding a New Thing that was > viewed at the time as an improvement over the existing thing(s). It'd be > an act of hubris to assert that the current "typing" module is the > ultimate, final library for expressing type information in Python. But if > we tie the language too strongly to the typing module, I fear we could > strangle its successors in their cribs. > > > */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/5NUVYOLIHEHS373WEK3D2ZGXSWPI5XV7/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido (mobile)
_______________________________________________ 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/CJRLXDSPFEP3V2PN2YIGQHXTQ6A262ZN/ Code of Conduct: http://python.org/psf/codeofconduct/