3 ms·
> Most “scripting” languages don't support annotations for checking parameters and return values PEP 3107 introduced function annotations to Python 3. The foll
by jdnier 13y ago
> Most “scripting” languages don't support annotations for checking parameters and return values
PEP 3107 introduced function annotations to Python 3. The following syntax is valid:
>>> def square(n: int) -> int:
... return n * n
...
>>> square(3)
9
Nothing is done with annotations by default. Here's an article discussing this "unused feature": http://ceronman.com/2013/03/12/a-powerful-unused-feature-of-python-function-annotations/ http://ceronman.com/2013/03/12/a-powerful-unused-feature-of-...
- skrishnamurthi 13y agoUnless I'm missing something, all the examples in that PEP are first-order. There's no discussion of what the semantics is in the higher-order case. Pyret's annotations are perfectly well-defined and draw on a long history of research of getting these very subtle cases right (starting with Findler and Felleisen's ICFP 2002 paper). There's much more to this than just syntax.