[Edu-sig] source code from SA:10648
jjposner at optimum.net
Fri Jul 16 18:31:44 CEST 2010
On 7/16/2010 9:59 AM, kirby urner wrote:
> ... Using print as a function is optional in 2.6 without
> importing anything special.
Kirby, I believe you're confusing these two invocations:
* Using the print *statement* with a single argument (or expression)
enclosed in parentheses.
* Using the print *function* with a single argument
Using multiple arguments clears things up:
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print 1,2,3,4 # statement with multiple arguments
1 2 3 4
>>> print(1,2,3,4) # statement with a single argument (a 4-tuple)
(1, 2, 3, 4)
>>> from __future__ import print_function
>>> print(1,2,3,4) # function with multiple arguments
1 2 3 4
P.S. The fact that the keyword "print" doesn't require a trailing SPACE
reminds me of the old DOS documentation for the command that changes to
the root directory:
That caused a lot of needless confusion!
More information about the Edu-sig