16 Aug
2014
16 Aug
'14
3:16 a.m.
Couldn't you do that today in Python with a suitably sophisticated function decorator? The range/type checking would happen before the user's actual function is called.
PyContracts does this; with (1) an @contract decorator, (2) Python 3 annotations, (3) with :type: and :rtype: docstrings ... http://www.reddit.com/r/Python/comments/2dh036/pythonideas_proposal_use_mypy... :
+1 for static typing for certain problems. [...] Static type checking at compile time (linting) looks really neat. [...] Do we need a separate approach for actual type assertions at runtime? Will that ever be in scope for mypy?