[Python-Dev] Suggestion: new 3 release with backwards compatibility

Guido van Rossum guido at python.org
Tue Jan 5 18:23:08 CET 2010


On Tue, Jan 5, 2010 at 8:50 AM, Michael Foord <fuzzyman at voidspace.org.uk>wrote:

>  On 05/01/2010 16:10, Juan Fernando Herrera J. wrote:
>
> How about a new python 3 release with (possibly partial) backwards
> compatibility with 2.6? I'm a big 3 fan, but I'm dismayed at the way major
> software hasn't been ported to it. I'm eager to use 3, but paradoxically,
> the 3 release makes me rather stuck with 2.6. Excuse me if this has been
> suggested in the past.
>
>
> I don't know about other developers, but I certainly expected Python 3
> adoption to take a few years due to libraries only gradually making the
> jump. I also expected there to be nervousness and pain around the migration
> as well.
>
> I think in fact that libraries *are* migrating and there are lots of
> encouraging signs. As a community we need to do all we can to promote Python
> 3 adoption, but I don't think there is much reason to be worried (or
> complacent for that matter).
>

Michael is right, but doesn't answer the OP's implied question "why can't
3.x be made backwards compatible with 2.6?"

Unfortunately the answer isn't easy. I wish it was "because we didn't have
time to do it" (since then the solution would be simply to call for more
volunteers to help out) -- but unfortunately, it comes closer to "we have no
idea how to do it."

Py3k was designed to be backwards incompatible, because that gives the most
long-term benefit of the language improvements. (Perhaps a better way of
saying this is that in the design of language improvements,
feature-by-feature backwards compatibility was intentionally not a
requirement, even though keeping most of the language mostly unchanged *was*
a requirement.)

In principle it would be possible to be more backwards compatible at the
syntactic level, but that's not where the pain of porting code lies -- the
major hurdles are typically he new way of thinking about Unicode (bytes vs.
text strings, instead of 8-bit-strings vs. Unicode strings), and the changed
semantics of dictionary keys and related APIs. Since these issues typically
exist across modules (passing strings and dicts between modules is common),
recognizing individual modules as "2.x" vs. "3.x" isn't possible.

Note, by the way, that you won't be "stuck" on 2.6 forever -- 2.7 alpha 1
was already released.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100105/eaba2f9b/attachment-0007.htm>


More information about the Python-Dev mailing list