question about input() and/or raw_input()
Rustom Mody
rustompmody at gmail.com
Sat Jan 18 23:43:39 EST 2014
More information about the Python-list mailing list
Sat Jan 18 23:43:39 EST 2014
- Previous message (by thread): question about input() and/or raw_input()
- Next message (by thread): question about input() and/or raw_input()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): question about input() and/or raw_input()
- Next message (by thread): question about input() and/or raw_input()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list