[Python-ideas] Proposal to extend PEP 484 (gradual typing) to support Python 2.7
Terry Reedy
tjreedy at udel.edu
Thu Jan 21 23:08:02 EST 2016
On 1/21/2016 1:44 PM, Guido van Rossum wrote:
[Snip discussion of nitty-gritty issue of annotating code, especially
2.7 code.]
I suspect that at this point making migration from 2.7 to 3.x *easier*,
with annotations, will do more to encourage migration, overall, than yet
another new module. So I support this work even if I will not directly
use it.
If you are looking for a PyCon talk topic, I think this, with your
experiences up that time, would be a good one.
Only slightly off topic, I also think it worthwhile to reiterate that
pydev support for 2.7 really really will end in 2020, possibly on the
first day, as now documented in the nice new front-page devguide chart.
https://docs.python.org/devguide/#status-of-python-branches
I have read people saying (SO comments, I think) that there might or
will be a security-patch only phase of some number of years *after* that.
> There's also a healthy set of tools that converts PY2 code to straddling
> code, approximately (e.g. futurize and modernize). What's missing (as
> you point out) is tools that help automating a larger part of the
> conversion once PY2 code has been annotated.
PEP 484 gives the motivation for 2.7 compatible type comments as "Some
tools may want to support type annotations in code that must be
compatible with Python 2.7. " To me, this just implies running a static
analyzer over *existing* code. Using type hint comments to help
automate conversion, if indeed possible, would be worth adding to the
motivation.
> But first we need to agree on how to annotate PY2 code.
Given the current addition to an accepted PEP, I though we more or less
had, at least provisionally.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list