Why is print
a keyword in python and not a function?
The print
statement in Python 2.x has some special syntax which would not be available for an ordinary function. For example you can use a trailing ,
to suppress the output of a final newline or you can use >>
to redirect the output to a file. But all this wasn't convincing enough even to Guido van Rossum himself to keep it a statement -- he turned print
into a function in Python 3.x.