Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 8
    In Python 2.x print is actually a special statement, not a function. This is also why it can't be used like: lambda x: print x Note that (expr) does not create a Tuple (it results in expr), but , does. Commented May 31, 2011 at 4:20
  • I'm assuming the support for print as a function and print as a statement is to maintain backwards compatibility with older versions of python while encouraging people to use the new syntax to migrate towards python 3. Commented May 31, 2011 at 4:21
  • 11
    p.s., To enable the print function in 2.7 (and not have the print statement behavior), you have to do a future import: from __future__ import print_function Commented May 31, 2011 at 4:23
  • Will the second example will in fact print "Hello,World!" (without the space) or will it print "Hello, World!" (with the space) as in the example. Commented Sep 6, 2019 at 7:24