Syntax error for simple script

mm0fmf none at invalid.com
Mon Jun 26 13:00:57 EDT 2017


On 26/06/2017 17:41, rurpy at yahoo.com wrote:
> On 06/26/2017 09:42 AM, Steve D'Aprano wrote:
>> On Tue, 27 Jun 2017 01:16 am, Ben S. wrote:
>>
>>> print mm + "/" + dd + "/" + yyyy + " " + hour + ":" + mi + ":" + ss
>>> ^
>>> SyntaxError: Missing parentheses in call to 'print'
>>>
>>> Whats wrong?
>>
>> Did you read the error message?
>>
>>      Missing parentheses in call to 'print'
>>
>> Is the message not clear enough? The call to print requires parentheses (round
>> brackets), like all other functions.
>>
>> print(mm + "/" + dd + "/" + yyyy + " " + hour + ":" + mi + ":" + ss)
>>
>>
>> If the error message isn't clear enough, what can we do to make it more clear?
>
> How about:
>
>    In Python 2, 'print' was a statement and did not require
>    parenthesis around its argument.  In Python 3 'print' has
>    been changed to a function and now, like all functions,
>    requires parenthesis around its arguments:
>      python 2:  print arg1, arg2,...
>      python 3:  print (arg1, arg2,...)
>
> Did you seriously not understand how someone, reading a tutorial or
> book written for Python 2, might be confused when a specific simple
> syntax he/she was explicitly told works, doesn't work?  Not everyone
> new to and starting to explore Python appreciates (?!) the major
> compatibility breaks that occurred between Py2 and Py3.  One would
> expect that in such a situation, the new user would certainly question
> his/her code rather than something changed in Python.
>
> Or better than changing the message, how about leaving it alone and
> simply responding helpfully rather than snappily and condescending to
> inevitable confusion that surely must have been anticipated when the
> Python developers chose to make this change.
>
> It's no wonder that some people (often women) who don't like contention,
> find this list rather hostile.
>

Sorry to victim blame but why can't people copy the error message into a 
search engine, such as Google, and see what the problem is themselves?

The first page of results gives plenty of detail of the differences 
between Python 2 & 3 and this print issue with lots of explanations 
about print vs. print().

I'd only start asking questions on a newsgroup if I couldn't find 
explanations on the web or having read the explanations they were all 
telling me different things.

YMMV




More information about the Python-list mailing list