So, what's the real story on Python 2 vs Python 3?
drsalists at gmail.com
Fri Dec 27 07:23:15 CET 2013
On Thu, Dec 26, 2013 at 9:43 PM, Rustom Mody <rustompmody at gmail.com> wrote:
> On Fri, Dec 27, 2013 at 10:50 AM, Andrew Berg <robotsondrugs at gmail.com> wrote:
> As for 2 maybe we need a wiki page. (Or do we have one already?)
> Heres my largely ignoramus attempt at starting that:
> 1. print: Use print with (). Dont use funny 2 syntax.
In fact, use parens with a single argument that may be a relatively
complex string % or .format expression. Otherwise 2.x will think it's
being passed a tuple and display accordingly.
> 2. Always write strings with a u" prefix
3.0, 3.1 and 3.2 don't understand this, but 3.3 does.
In a project I wanted to run on 2.5, 2.6, 2.7, 3.0, 3.1, 3.2 and 3.3,
I dedicated a python module to most of my string constants, and
converted as needed using a pair of helper functions. If Jython had
been available with 2.7 compatibility at the time, I would've ignored
2.5 and 2.6; now Jython has a 2.7 beta which is good enough for at
least some of my purposes.
More information about the Python-list