Python is going to be hard
rustompmody at gmail.com
Thu Sep 4 04:33:41 CEST 2014
On Thursday, September 4, 2014 7:56:31 AM UTC+5:30, Chris Angelico wrote:
> On Thu, Sep 4, 2014 at 12:10 PM, Rustom Mody wrote:
> > On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote:
> >> On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote:
> >> >>>> NO PRINT
> >> Why are you so dead against print?
> > Because it heralds a typical noob code-smell
> > [especially when the OP admits that BASIC is his background]
> And, of course, all those lovely Unix programs that produce output on
> stdout, they're full of code smell too, right? I don't care what
> someone's background is; console output is *not* code smell.
Tell me the same after having taught a few thousand students
If you are at the level of writing useful unix scripts, you are not
going to be asking these questions.
> Anyway, all you're doing is relying on the magic of interactive mode
> to call repr() and print() for you.
Yes its usually called DRY.
That P in the REPL is put in a neat and nifty place. Why repeat?
> >> Yes, or the OP could work with actual saved .py files and the
> >> reliability that comes from predictable execution environments... and
> >> use print.
> > Dunno what you are talking about
> > The interpreter-REPL is less reliable than a script?
> When you start a script, you have a consistent environment - an empty
> one. When you write a series of commands in the interactive
> interpreter, the environment for each one depends on all the preceding
> commands. So when you have a problem, you might have to copy and paste
> the entire interpreter session, rather than just the one command.
Agreed. Thats a downside.
Very minor compared to the mess induced by unstructured print-filled noob code.
More information about the Python-list