On Wed, Apr 14, 2021 at 10:44 AM Larry Hastings <la...@hastings.org> wrote: > > > On 4/13/21 1:52 PM, Guido van Rossum wrote: > > > Because typing is, to many folks, a Really Important Concept, and it's > confusing to use the same syntax ("x: blah blah") for different purposes, in > a way that makes it hard to tell whether a particular "blah blah" is meant as > a type or as something else -- because you have to know what's introspecting > the annotations before you can tell. And that introspection could be > signalled by a magical decorator, but it could also be implicit: maybe you > have a driver that calls a function based on a CLI entry point name, and > introspects that function even if it's not decorated. > > > I'm not sure I understand your point. Are you saying that we need to take > away the general-purpose functionality of annotations, that's been in the > language since 3.0, and restrict annotations to just type hints... because > otherwise an annotation might not be used for a type hint, and then the > programmer would have to figure out what it means? We need to take away the > functionality from all other use cases in order to lend clarity to one use > case? >
I don't think we need to take away "general purpose functionality". But if we define type hinting is 1st class use case of annotations, annotations should be optimized for type hinting. General purpose use case should accept some limitation and overhead. On the other hand, if we decide general purpose functionality is 1st class too, we shouldn't annotation syntax different from Python syntax. But annotations should be optimized for type hinting anyway. General purpose use case used only is a limited part of application. On the other hand, type hint can be used almost everywhere in application code base. It must cheap enough. Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ 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/UGFWTZUGH6QZRHF3FKTQHZLYG2ZNX5EG/ Code of Conduct: http://python.org/psf/codeofconduct/