Python Sanity Proposal: Type Hinting Solution

Rick Johnson rantingrickjohnson at gmail.com
Fri Jan 23 20:36:33 CET 2015


On Thursday, January 22, 2015 at 9:24:01 PM UTC-6, Rustom Mody wrote:
     
> > ============================================================ 
> >  Simplistic Example Code utilizing two files: 
> > ============================================================ 
> > 
> > [...snip code example...]
> > 
> 1. Allow in same file
> 2. Change syntax slightly to:
>    type greeting : str -> str

While i'll agree that removing the hints from sigs is better
than the alternative of injecting noise into sigs, i still
feel as though type hints will "dirty" the purity of source
no matter how wonderful the declaration might to be.

I believe strongly that LOD is the only method we can apply
that will allow us to "bolt on" non-destructive type hints
in Python. So although your idea is an improvement, i'm
sticking with the "stub file solution". (unless something 
better is offered)

> [type is the keyword equivalent to your other typehint file ]
>  and you have essentially the Haskell solution.
> 
> The catch I expect is that haskell is strongly committed to simultaneous
> definitions:
> 
> x = 1
> y = x+2
> 
> is the same as
> y = x+2
> x = 1
> 
> and so definitions can generally be permuted around
> 
> Python is committed to the opposite extreme:
> even def and class are not declarative but imperative

I'm sorry, but i was unable to understand how your last
point was relevant to type hints? 




More information about the Python-list mailing list