Why is print
a keyword in python and not a function?
print
was a statement in Python because it was a statement in ABC, the main inspiration for Python (although it was called WRITE
there). That in turn probably had a statement instead of a function as it was a teaching language and as such inspired by basic. Python on the other hand, turned out to be more than a teaching language (although it's good for that too).
However, nowadays print
is a function. Yes, in Python 2 as well, you can do
from __future__ import print_function
and you are all set. Works since Python 2.6.