On 04/16/2013 05:47 PM, Andy McKenzie wrote:
On Tue, Apr 16, 2013 at 5:31 PM, Dave Angel <da...@davea.name> wrote:

    <SNIP>

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.


That's good to know, since I hadn't run into it yet.

So am I correct in understanding that I can just put the from __future__
import print_function in each new 2.7 script, and get identical
functionality to what happens in 3.x?  Or do I need to do that system-wide
somehow?


Someone else may know if "identical" has some exceptions. But as for where to put it, you'd need it for any module (including your own script) which is going to use the newer print() function.

And the nice thing is that the from-future directive is ignored in 3.x, so you don't have to remove it when you do progress.

--
DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to