Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • I know Python is not PHP, but they banned the use of print 'something', now you always have to use print('something') with the parentheses. Commented Aug 22, 2010 at 18:44
  • Also see: ideone.com/LUOOG Commented Aug 22, 2010 at 18:57
  • No. It does make a difference. Even though it outputs the same the version with parentheses looks different. The parentheses and function like formatting make it look different. At least I would be fooled into thinking that it outputs foobar, if I didn't stop to think about it. Commented Aug 22, 2010 at 19:00
  • 1
    Yes, you are right, it outputs the same thing. Maybe I didn't explain my point clearly. I'm talking about the understandability of the code, not of the functionality. The functionality doesn't change, that's correct. Commented Aug 22, 2010 at 19:03
  • Though there actually is one case, there using parentheses will not only make the code less understandable, but will actually break things. If you have a function which returns by reference return($a) will not work, because it will not return a reference to $a, but the result of the expression ($a), which obviously is a value, not a reference. But this is off topic, because we're talking about print and echo ^^ Commented Aug 22, 2010 at 19:09