Difficult? No, it's not difficult at all. In fact, it was a good decision, getting rid of the special syntax for print and making it a function like all others. My argument still stands, though.
You can syntactically pretend it's a function, but it's still not a function. If you need a printing function pre-3.0 you'll still have to use os.write() or something like that.
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = print
File "<stdin>", line 1
x = print
^
SyntaxError: invalid syntax
>>> help(print)
File "<stdin>", line 1
help(print)
^
SyntaxError: invalid syntax
>>> print("hello")
hello
You still need to enter from __future__ import print_functionin Python 2. After that, it is a function. (Just putting the string in parens should always have been valid code, that's just their usual grouping functionality.)
21
u/[deleted] May 09 '12
Old, and wouldn't this be true of every language?