[Python-3000] Add python-3000-like print function to python 2.6

David A. Wheeler dwheeler at dwheeler.com
Wed Oct 17 05:47:41 CEST 2007


Guido van Rossum wrote:
> > I expect this will happen. At the very least, you'll be able to just
> > use 'print' for that function's name if you include
> >   from __future__ import print_function

Neal Norwitz wrote:
> There's a patch for this too.  http://bugs.python.org/issue1633807

Excellent!  I like the "from __future__..." approach better than what I'd originally proposed.  If that is the plan for Python 2.6 (and I hope it is), can I appeal to someone to modify PEP 3105 to specifically _note_ that this is a planned addition for 2.6?  Just a sentence or two would do it, e.g.: "Python 2.6 will include a 'from __future__ import print_function', which enables use of print as a function with these semantics instead of the traditional Python 2 print statement.".  A note in some other materials about Python 2->3 transition would be nice too.

Also... will the 2to3 tool support this?  What I mean is, if 2to3 sees "from __future__ import print_function", will it leave print function calls alone?  If not, could that be changed?

Thanks.

--- David A. Wheeler 


More information about the Python-3000 mailing list