Dnia 18-08-2009 o 22:42:59 Robert Dailey <rcdai...@gmail.com> napisaƂ(a):

I see what you're saying now. However, why am I able to use print as a
function in general-purpose code in my Python 2.6 script, like so:

def SomeFunction():
   print( "Hello World" )

But, I am not able to do this:

SomeFunction = lambda: print( "Hello World" )

??????

Because (unless you do 'from __future__ import print_function' in Py2.6)
it's statement, not a functions. In Python you can put any expression
in parentheses -- it's useful for wraping long lines but changes nothing
semantically (unless you add a comma -- then you create a tuple, even
without parentheses, but it'a another story...).

*j

--
Jan Kaliszewski (zuo) <z...@chopin.edu.pl>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to