In principle, I like this idea, this will save some keystrokes and will make annotated code more "beautiful". But I am quite worried about the backwards compatibility. One possible idea would be to use __future__ import without a definite deprecation plan. If people will be fine with using typing.get_type_hints (btw this is already the preferred way instead of directly accessing __annotations__, according to PEP 526 at least) then we could go ahead with deprecation.
Also I really like Yury's idea of dynamic mapping, but it has one downside, semantics of this will change: def fun(x: print("Function defined"), y: int) -> None: ... However I agree functions with side effects in annotations are very rare, and it would be reasonable to sacrifice this tiny backwards compatibility to avoid the __future__ import. -- Ivan
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/