Why can't I assign python's print to a variable?
I'm learning to program and I am using Python to start. In there, I see that I can do something like this: >>>> def myFunction(): return 1 >>>> test = myFunction >>>> test() 1 However, if I try and do the same with print it fails: >>>> test2 = print File "<stdin>", line 1 test2 = print ^ SyntaxError: invalid syntax Why is print different than a function I create? This is using Python v2.7.5. BrenBarn print is a statement , not a function. This was changed in Python 3 partly to allow you to do things like this. In Python 2.7 you can get print as a function by doing from __future__ import print