Chris Angelico wrote: > On Thu, Sep 4, 2014 at 4:23 PM, Rustom Mody <rustompm...@gmail.com> wrote: >> You seem to think a print hanging out of a program to be ok, normal. >> I consider it exceptional. > > You keep saying that it's exceptional. You haven't really said why. > It's the simplest form of "program produces output for the human to > see", which all of your subsequent examples are more complicated > versions of:
Out of the Python built-ins, how many functions (apart from print itself!) print output instead of, or as well as, returning? Out of the standard library, what percentage of functions and methods print output instead of, or as well as, returning? I haven't counted, but I'm guessing it will be well under 1%. There's a few obvious examples: pprint.pprint, calendar.pr*, dis.dis, maybe a few more. But I think they should be considered *exceptional*. We often recommend using print as an easy and effective debugging tool. But we don't (well, I don't) recommend leaving those print statements in the code once the problem is debugged. -- Steven -- https://mail.python.org/mailman/listinfo/python-list