> Why won't it be possible to make 'print' in Python 3 that supports all > the functionality of the current print statement, and then translate to > that ? > I saw an assertion to the effect that it wasn't possible - but no proof.
As discussed in the original post, the problem is the reverse: the Python 2.x print statement does not support the keyword args required by the pep, so that print(foo) **in Python 2.x** can not simulate the effect of the print statement with a trailing comma. Here is the theorum carefully stated and proved. Theorem: is not possible to define a function called print in Python 3.x such that A) print (whatever) is syntaxtically valid in Python 2.x and B) print(whatever) outputs what 'print whatever' outputs in Python 2.x for all values of 'whatever'. Proof: It is impossible for the print function to simulate the effect of the print statement with a trailing comma. Indeed, print ('line'), and print ('line',) (note the position of the commas) are valid in Python 2.x, but neither does what is wanted. And print('line',end='') is invalid in Python 2.x. Let's look at some examples: 1. The following works (prints 'line after\n') in Python 2.x, but will not suppress the newline in Python 3.x: print('line'), print('after') 2. The following doesn't work in Python 2.x. (It prints "('line',)\nafter"). print ('line',) print ('after') 3. print ('line',end='') produces a syntax error in Python 2.x: print ('line',end='') ^ SyntaxError: invalid syntax That's the proof. Can you find a flaw in it? Edward -------------------------------------------------------------------- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -------------------------------------------------------------------- -- http://mail.python.org/mailman/listinfo/python-list