On 04/16/2013 05:20 PM, Andy McKenzie wrote:
<SNIP>
Thanks for the advice, folks. Given that it looks like the biggest changes
are unicode handling (which I'm not going to need any time soon) and the
way the print function works, I decided to stick with 2.7. I'm an IT guy,
though unemployed at the moment, and it occurred to me that "I'm familiar
with Python, but not the version your entire established codebase is in"
wasn't a great thing to have on a resume.
Since it looks like the new formatting for print -- that is, print("Print
this stuff!") -- works fine in 2.7, I'm just getting myself used to doing
that from the beginning.
The degenerate print, where you're printing exactly one thing, works the
same. But if you have two things to print, putting parens around them
in Python 2.x will cause a tuple to be printed, rather than printing the
two with a space between.
>>> print(3,5) -- version 2.x
(3, 5)
>>> print(3,5) -- version 3.x
3 5
To get 3.x functionality, you'd want to use
from __future__ import print_function
and I do not think that works in 2.6 or older versions. It also can be
awkward even in 2.7 if you're mixing existing code with new print functions.
--
DaveA
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor