[Python-ideas] PEP 484 (Type Hints) -- first draft round

Steven D'Aprano steve at pearwood.info
Tue Jan 20 12:06:27 CET 2015

On Tue, Jan 20, 2015 at 07:59:40PM +1300, Greg Ewing wrote:
> 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.

Then I guess Python won't have static type checking.

I think Guido has been very clear that he has little interest at this 
stage (if ever) about introducing a Java/Pascal/Haskell style statically 
typed compiler to Python. I seem to recall he expressed considerable 
skepticism that such a thing was even practical, or useful even if it 
could be done. I recall Guido expressing doubts that Nuitka's approach 
of trying to optimize code statically at compile-time will ever beat 
Cython's and PyPy's JIT approaches. So anyone thinking that this is the 
first step to turning Python into Haskell is probably mistaken :-)
A type-checker that operates similarly to a linter is proven technology, 
thanks to mypy. So let's not waste too much time talking about syntax 
for some feature that Python will probably never get, and even if it 
does get it, it won't be in 3.5. How about we play around with 
type-checkers for a release or ten before proposing static typing for 


More information about the Python-ideas mailing list