On Sunday, January 19, 2014 9:51:36 AM UTC+5:30, Chris Angelico wrote: > On Sun, Jan 19, 2014 at 3:15 PM, Rustom Mody wrote: > > On Sunday, January 19, 2014 12:00:20 AM UTC+5:30, Roy Smith wrote: > >> Pardon me for being cynical, but in the entire history of the universe, > >> has anybody ever used input()/raw_input() for anything other than a > >> homework problem? > > Similar 'cynicism' regarding print would be salutary for producing better > > programmers > > [If youve taught programming and had to deal with code strewn with > > prints...]
> Why, exactly? How ought a program to produce filterable output? Because these two pieces of code >>> def foo(x): print x+1 >>> def bar(x): return x+1 look identical (to a beginner at least) >>> foo(3) 4 >>> bar(3) 4 >>> And so if they see prints used cavalierly for demo purposes, they think the prints are also ok for production. As a professional programmer, you would of course understand - 'normal' code that does some processing and then some output should not have prints in the processing - web-serving (type of) code that has little other than heavy-duty printing should probably use a template engine of some sort In any case prints all over is a code-smell exacerbated by the way that manuals/examples need to be written -- https://mail.python.org/mailman/listinfo/python-list