[Python-Dev] PEP 0484 - the Numeric Tower

Chris Barker - NOAA Federal chris.barker at noaa.gov
Wed Oct 14 11:47:57 EDT 2015


>> Well, that's what you get in exchange for "type safety".
>
> AIUI, the point of type annotations is that some use cases benefit *a
> lot* from machine-parsable type information, not that type annotation
> is a universally good idea in itself.  It's not type *safety* that's
> the aim here.  It's type *auditability*.  If it were about "safety",
> annotations would be in the interpreter, not in a separate, optional
> application.

Well, what's the point if you don't use it? I'm probably being
paranoid here, but I can envision institutions that enforce running
the type checker for any committed code, etc... And then for practical
purposes, it's enforced on that project.

>> Which is exactly why I'm concerned about widespread use of type
>> annotations. Might as well use a static language :-(
>
> No, no way would this satisfy static typing advocates.  Optional,
> remember?

Notice that I said "widespread" -- and again, paranoia: it'll always
be optional in Python itself, but it may not be optional in some
institutions/code bases.

> In Python, widespread use of type annotations that messes up Decimal
> users would be un-Pythonic

Well yes, that's my point :-)

>  you can't simply refuse to run the type checker,

If you can simply refuse to run the type checker, then it makes me
wonder what the point of the type checker is :-)

Anyway, lots of folks think type annotations will be useful without
constraining the language -- and now we have a standard way to do it
-- so I guess we'll see how it plays out.

-CHB


> I will bet that
> Guido himself will be your champion.[1]
>
> Footnotes:
> [1]  I'm not channeling anybody here, that's a statement of my
> personal assessment of the real risk.  And of course it may have no
> effect on the developers who use type annotations in that way, but
> this is no different from any other hard to work around programming
> practice.
>
>


More information about the Python-Dev mailing list