|
|
Subscribe / Log in / New account

Debating a "transitional" Python 2.8

Debating a "transitional" Python 2.8

Posted Jan 2, 2014 19:57 UTC (Thu) by iabervon (subscriber, #722)
Parent article: Debating a "transitional" Python 2.8

I kind of like the idea of a "Python 2.8" which is produced from a Python 3 source tree, is compatible with 2.7, has 2.x semantics (unmarked string constants are bytes, not unicode), but insists on more portable usage.

For example, it could still recognize the print statement by default, but consider it deprecated or illegal. If you want to use "print" you need "from __future__ import print_function;" and to use it as a function, but it also doesn't just start handling things the new way. Likewise, it understands ambiguous "except" clauses the 2.x way, not the 3.x way, but it prohibits it.

Personally, I think the biggest impediment to Python 3 adoption is that it lacks support for "unicode" and the "u'foo'" syntax. Other than that, it would be possible to have a 2.8 that makes you write version-agnostic code, but there's no way to get Python-3 strings that also works in 2.7 for 2.8 to demand.


to post comments

Debating a "transitional" Python 2.8

Posted Jan 4, 2014 23:15 UTC (Sat) by juliank (guest, #45896) [Link] (1 responses)

u"foo" is back in Python 3.3. And b"foo" is supported in Python 2.7, so you can just use b"foo" and u"foo" in code and it will work in both versions.

Debating a "transitional" Python 2.8

Posted Jan 4, 2014 23:47 UTC (Sat) by iabervon (subscriber, #722) [Link]

Excellent! I'd only found a 3.0-era comparison between 2.x and 3.x, and tested on 3.2.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds