[Python-ideas] PEP 484 (Type Hints) -- first draft round
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Jan 20 07:59:40 CET 2015
Stephen Hansen wrote:
> On Mon, Jan 19, 2015 at 10:22 PM, Greg Ewing
> <greg.ewing at canterbury.ac.nz <mailto:greg.ewing at canterbury.ac.nz>> wrote:
>
> quack :: lambda float, int: AnimalSound
> def quack(volume, num_times):
> ...
>
> That's still verbose, its simply vertically verbose. We have decorators
> for adding information in the vertical space.
>
> Then you have decorators and
> ... whatever you call that line? What's the difference?
The difference is that the :: annotations would *not* be
evaluated a run time. There's currently no way to get
that with a decorator, or anything else in the language,
short of abusing comments or string literals.
Yet it's what you really want for static type checking.
--
Greg
More information about the Python-ideas
mailing list