[Python-ideas] Proposal: Use mypy syntax for function annotations
Skip Montanaro
skip at pobox.com
Thu Aug 14 21:34:51 CEST 2014
On Thu, Aug 14, 2014 at 2:28 PM, Dennis Brakhane
<brakhane at googlemail.com> wrote:
> public Response register(@Range(18,100) int age, @ValidEmail String
> email) { ... }
>
> The framework would check the range of the age parameter and the
> validity of the email and if there are validation errors,
> refusing the request with a suitable error message without ever calling
> our function.
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.
Skip
More information about the Python-ideas
mailing list