Old Man Yells At Cloud

Tim Golden mail at timgolden.me.uk
Sun Sep 17 09:51:12 EDT 2017



On 17/09/2017 14:34, breamoreboy at gmail.com wrote:
> On Sunday, September 17, 2017 at 2:16:48 PM UTC+1, bartc wrote:
>>
>> print can also be used for debugging, when it might be written, deleted
>> and added again hundreds of times. So writing all those brackets becomes
>> irksome. 'print' needs to be easy to write.
>>
>> -- 
>> bartc
> 
> Experienced Python programmers use the logging module for debugging, write once, delete (maybe) never.

FWIW I'm with Bart on this one. Print-as-a-function removed one small 
simplicity which I appreciated in Python as I first encountered it. And 
I'm entirely unconvinced that the benefit is worth it. That was my view 
when Python 3 was launched and several years of happily using Python 3 
have not made a difference to my opinion on this particular point: I 
simply grin and bear it.

Funnily enough, the two arguments most often advanced for 
print-as-function seem to me to cancel each other out. Argument 1 is 
"this way you can redefine print to be, eg, write_to_this_log"; and 
Argument 2 is "but no-one uses print in real code anyway" -- more or 
less what Mark offered just now.

Well if no-one uses it in real code, then its ability to be redefined is 
moot. (Or, rather, the strength of that argument is diminished).

In my own code I'm obviously quite capable of defining a function p() 
which does whatever I want in terms of printing etc. But where this 
bites me the most is in the interactive interpreter. Yes, I'm aware I 
can add things to site.py etc. etc. My point would still be that I'm 
working around a change which appears to be solving a problem I didn't have!

TJG



More information about the Python-list mailing list