[Python-ideas] from __past__ import division, str, etc

Alejandro López Correa alc at spika.net
Wed Jan 8 17:22:02 CET 2014


Answering both Chris Angelico and you, I think I have not made my point
clear. I am not really complaining about python 3. My opinion about the
changes (at least those of which I am aware) is that they are sane.
Unfortunately, many people are reluctant to change, and from what I've read
that is actually a problem (not that I have actual data). I think large
python 2 code bases won't change unless the benefits are larger than the
costs. In the costs we have to count the available developer time, for
example, and in many cases that means [a lot of] money. The idea is to
offer a solution to those programmers so they can trivially port their code
base, write new code in python 3 and rewrite old python 2 code as soon as
possible.

I am not suggesting offering back the whole python 2.7 by any means. Many
changes can be safely performed by the 2to3 tool, probably. My suggestion
is to offer a convenient way to bring everybody into python 3.

> My apologies, that was rather rude of me when you're offering to help
No worries.

> The main challenge is thus getting people to stop asking the question
> "How do we bring back the Python 2 text model" (which is never going
> to happen - we changed the model for a reason), and instead ask "What
> changes can be made to Python 3, such as introducing additional
> purpose specific types, to make it a better language for wire protocol
> development?". There's nothing actually *saying* "thou shalt only use
> builtin types for manipulation of wire protocol data", but that's the
> way all porting efforts have been carried out to date.
Enabling old functionality when required is not the same as bringing back
python 2, since python 3 is there by default and python 2 code won't work
by default. It means just providing a good way to make old code work. The
key part is the translation from 2 to 3. This does not mean that the code
has to run unchanged but that the translation may be performed
automatically, at least in 99.9% of cases. In practice this could involve a
mixture of changes to python 3 itself to support the 2to3 tool, and
improvements to the tool.

With a 2to3 tool that covers 99.99% of the cases, we could even have .py2
modules that would be translated transparently to .py when first used, in
the same way compilation works, raising an exception in case something goes
wrong.

Anyway, I understand it is not a clean way to proceed, but something along
these lines might be the only way to speed up the adoption of python 3, and
minimise the risk of defection to other languages.

Cheers,
Alejandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140108/44466732/attachment-0001.html>


More information about the Python-ideas mailing list