-4

Is it normal for me to use parenthesis when making a call to print in Python 2.7? I thought only 3 onwards needs to do this?

without the parenthesis I get a syntax error.

SyntaxError: invalid syntax

but with parenthesis, it works.

I was under the assumption that 2.7 doesn't need parenthesis to print?

Boosted_d16
  • 13,340
  • 35
  • 98
  • 158

1 Answers1

0

Your impression is correct, it's not needed (unless of course you import print_function von __future__!). However, it's not prohibited either. print is followed by an expression, and (sys.version) is a valid expression as much as sys.version is. Note that (x) does not create a tuple containing x (that would be (x,)).