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
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

-John

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:

  cd\

That caused a lot of needless confusion!

_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to