On Tue, Nov 12, 2013 at 7:10 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
On 12 November 2013 20:47, Ethan Furman <ethan@stoneleaf.us> wrote:
> If you don't like `print()`, do a `p = print` and then all you have is `p()`
> -- of course, you just lost a bunch a readability.
>
> But seriously, have often does any real program use print?

It's far more common in utility scripts (such as those written by
system administrators) than it is in applications. The print change
between Python 2 and 3 is one that doesn't really affect application
developers all that much in practice (other than when trying things
out in the REPL, and apparently not even then if using IPython), but
can be more of an issue with those writing scripts where the standard
streams are the primary IO mechanism.

We tend not to hear from the latter group as much as we do from
application developers, though.


Having written a lot of applications and both small and large scripts I've almost universally regretted using print instead of a logger. It's (slightly) more setup, but the second you want to make any changes to your output (timestamps, suppressing certain messages) it more than makes up for it.  
 
Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas