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

Cem Karan cfkaran2 at gmail.com
Mon Jan 19 22:53:05 CET 2015


On Jan 19, 2015, at 3:30 PM, Devin Jeanpierre <jeanpierreda at gmail.com> wrote:

> On Sun, Jan 18, 2015 at 4:01 PM, Greg <greg.ewing at canterbury.ac.nz> wrote:
>> On 19/01/2015 8:34 a.m., Guido van Rossum wrote:
>>> 
>>> I'm putting a line in the sand: annotations are
>>> for types
>> 
>> 
>> Do you mean *static* types, or types in general?
>> 
>> If they're only for static type checking, this seems a waste of a
>> facility that evaluates things at run time. Moreover, evaluating
>> them at run time is actually counterproductive, since it makes
>> dealing with things like forward references unnecessarily awkward.
>> It also introduces useless runtime overhead. And they only address
>> part of the problem, since they only apply to functions and not
>> other things we might want to specify the type of.
> 
> Strong +1. The current proposal is a historical accident, it would not
> be designed this way if it was designed from scratch. That's not a
> nice thing to include in the core language. (Although it does happen
> often, since "practicality beats purity").
> 
> I like the :: idea.

+1 on the :: idea.

As for the typing system, I think the proposal is pretty much spot on.  I know I've been harping on annotations being forcefully restricted to types only, but the proposal itself (the typing library, etc.) is a really good proposal.  Unless Python suddenly stops being Python, it's not too likely that any typing system can handle all possible cases of what we can do in the language (at least, not without becoming insanely unwieldy).  

Thanks,
Cem Karan


More information about the Python-ideas mailing list