[Python-Dev] Type hints -- a mediocre programmer's reaction

Paul Sokolovsky pmiscml at gmail.com
Tue Apr 21 13:38:39 CEST 2015


Hello,

On Tue, 21 Apr 2015 11:56:15 +0100
Rob Cliffe <rob.cliffe at btinternet.com> wrote:

> On 21/04/2015 10:33, Cory Benfield wrote:
> > On 21 April 2015 at 10:10, Chris Angelico <rosuav at gmail.com> wrote:
> >> At this point, you may want to just stop caring about the exact
> >> type. Part of the point of gradual typing is that you can
> >> short-cut a lot of this. And quite frankly, this isn't really
> >> helping anything. Just skip it and say that it's Union[Mapping,
> >> Iterable, None].
> > I think this is my problem with the proposal. This change doesn't
> > catch any of the bugs anyone was going to hit (no-one is passing a
> > callable to this parameter), and it doesn't catch any of the bugs
> > someone might actually hit (getting the tuple elements in the wrong
> > order, for example). At this point the type signature is worse than
> > useless.

> Exactly.  At this point putting the type signatures in seems to be a 
> pointless exercise in masochism (for the author) and sadism (for the 
> reader).

Or interesting and productive exercise, which will lead to further
improvements and benefits - for other kinds of authors and readers.
Those kinds left your kind alone by letting to keep not writing
annotations. Why you feel so embarrassed to let the other kind
progress? Python becomes multi-paradigm language, what's so bad with
that?

You're afraid that you will have discomfort reading other's code? My
god, I love Python, and hate 50% of code written in it, most of it
needs to be rewritten to be satisfactory! Why it bothers you that there
will be direction on how other people may (re)write it?

> 
> The refreshing thing about Python is that it is a fantastic,
> *concise*, dynamically typed language, at the opposite end of the
> spectrum from C++ (ugh!).

C++ is fantastic, concise, statically typed language. You've just used
to see 90% of code in it which needs to be rewritten.

[]

> Apologies, Guido, but:
[]
> You see where I'm going with this - adding type hints to Python feels
> a bit like painting feet on the snake.  Or at least turning it into a 
> different language.

I'm sure type annotations never could be discussed for inclusion if
Guido didn't feel that they fit with Python's way. Sometimes it makes
sense to trust BDFL. It's much less obtrusive and qustionable change
than forcing Unicode by default, making print a function, or keeping
3-headed sys.exc_info() ugliness instead throwing it out of Python3.

Because well, type annotation *are optional*. And it's by now clear
that there will be --strip-type-annotations flag to pip and stickers
"This system runs type annotations free".

> 
> Best wishes
> Rob Cliffe



-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com


More information about the Python-Dev mailing list