[Python-Dev] Please reject or postpone PEP 526

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 4 17:59:12 EDT 2016


> On Sun, Sep 04, 2016 at 12:31:26PM +0100, Mark Shannon wrote:
> 
>> As defined in PEP 526, I think that type 
>>annotations become a hindrance to type inference.

In Haskell-like languages, type annotations have no
ability to influence whether types can be inferred.
The compiler infers a type for everything, whether
you annotate or not. The annotations serve as
assertions about what the inferred types should be.
If they don't match, it means the programmer has
made a mistake somewhere.

I don't think it's possible for an annotation to
prevent the compiler from being able to infer a
type where it could have inferred one without the
annotation.

-- 
Greg


More information about the Python-Dev mailing list