[Python-Dev] Reserve ':=' for type-inferred variable initialization (was PEP 572)
Steven D'Aprano
steve at pearwood.info
Fri Apr 27 08:28:46 EDT 2018
On Fri, Apr 27, 2018 at 08:13:20AM +0200, Andrea Griffini wrote:
> >> We're focused on Python 3.8 and 3.9, not Python 5 or Python 6.
>
> Hmmm... When I was hearing the repeated belated saying that Python
> will never ever jump on the statically typed ship on each and every
> static type annotation discussion I started to worry this wasn't
> indeed the case (why the urge of repeating it so much otherwise?).
Only because people keep worrying about it. If we don't deny it, people
will think our failure to deny it means it will happen. If we do deny
it, they think that our repeated denials means it will happen. We're
damned whatever we do.
> Now we got standard library features requiring type annotation
We do? Did I miss them? Which std lib features are you referring to?
(That's not a rhetorical question -- maybe I have missed something.)
> and a little shift towards a "not now" position.
If you're referring to my comment above about "Python 5 or Python 6",
perhaps I should have followed my first instinct and written "Python
5000". You know, the Python we get in the year 5000 :-)
Guido has said that Python will never *require* type-annotations and
static type-checking, and I see no reason to doubt that. But this
doesn't rule out a hypothetical runtime option (hence, *optional*) to
enforce static type-safety some time in the future.
Personally I doubt this will happen: mypy is a non-trivial project
itself, by my estimate about 200 .py files, 77000 lines of text, about
60 kloc, and I don't think Guido wants to build it into the reference
Python interpreter. And why bother, when it is so easy to add a single
dependency (mypy) and integrate it with your work-flow?
My point was that reserving syntax for such a hypothetical future Python
is a waste of time. Even if it happens, which it probably won't, it
won't happen any time soon. By the time this hypothetical future rolls
around, who knows what syntax we'll want?
--
Steve
More information about the Python-Dev
mailing list