[Tutor] print function in python 2.6 and 3

Alan Gauld alan.gauld at btinternet.com
Thu Feb 12 22:50:44 CET 2009


"Sander Sweers" <sander.sweers at gmail.com> wrote

> I see more people posting answers with the new print() function only
> available in python 3 and in python 2.6 via an import from 
> __future__.
> Now I am not confused by this but I can understand that people very
> new to python can get confused byt this. Especially people following 
> a
> guide online or a book which almost all use the old print statement.

Yes, it is unfiortunate but will settle down over the next year or so 
I guess.

> Now what should be used and promoted on the list?

We can't shouldn't promote one over the other since the remit
of this list is to help newbies, regardless of the Python version.
We had similar issues when Python 2 introduced strings as
objects and string methods replaced the functions in the string
module - indeed we still get posts using string.foo...

The only thing I would strongly request is that posters specify
the Python version (both in questions and replies) . That's always
a good idea but especially during a time of change.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list