syntax difference (type hints)
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Jun 18 20:45:17 EDT 2018
On Mon, 18 Jun 2018 14:57:30 +0000, Schachner, Joseph wrote:
> Assuming that we want Python to remain a dynamically typed (but strongly
> typed) language,
There is no question about that.
> I believe the proposed type hints are only necessary
> for function definitions,
What is the basis of this belief? How much experience do you have using
type annotations and gradual typing?
On a scale of 0 to 10, where 0 is "never even used it", and 10 is "used
it extensively on projects with tens or hundreds of thousands of lines of
code", where do you fit?
Because type annotations and gradual typing *is* being used extensively
on huge code bases at Dropbox, and they have been using it for years, and
I can tell you that the type hinting features being added to Python, such
as the ability to annotate names outside of function definitions, *are*
necessary.
Which won't come as a surprise to anyone who has used languages with type
inference. Sometimes the type system cannot infer the type of a variable
or name, and needs a hint from the author. ML proved that nearly fifty
years ago.
Honestly folks, you're talking as if what Python is doing is cutting edge
experimental stuff. It isn't. It is *old and boring* and well-understood
with nearly half a century of practical experience behind it.
You all sound like old BASIC programmers bitterly complaining about this
new-fangled idea of "functions" when all anybody could possibly need is
GOTO and a good memory for remembering line numbers.
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson
More information about the Python-list
mailing list