On 6/26/2010 8:02 PM, Paul Rubin wrote:
Terry Reedy<tjre...@udel.edu>  writes:
Having completely switched from 'printf(' to 'print ', I have had a
bit of a problem switching back to 'print('. It is my single largest
source of typos. But a decent system that puts me at the site of
syntax errors alleviates this. Logic bugs are a much bigger problem.

I tend to print a lot of tracing messages in my programs, in the form

    print (x, y, z)

expecting to print the tuple (x,y,z) in a form that I can read back
into an analysis program.  That's going to break without throwing
any syntax errors if I ever switch to Python 3.

I would hope and expect that 2to3 will properly add a second pair. But I can see that that would be a problem with new code. To make your life easier, and even save keystrokes:

>>> print((1,2,3))
(1, 2, 3)
>>> def tp(*args): print(args) # tuple print

>>> tp(1,2,3)
(1, 2, 3)

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to