Experiences/guidance on teaching Python as a first programming language

Chris Angelico rosuav at gmail.com
Thu Dec 12 05:20:47 CET 2013

On Thu, Dec 12, 2013 at 2:52 PM, rusi <rustompmody at gmail.com> wrote:
> Which comes back full-circle to where we started: if
> main() { printf("Hello World\n"); }
> is the foundation on which other programs are built, then later excising
> the print(f) is a significant headache -- at least for teachers as Steven
> also seems to have found.
> If instead the print was presented more as a 'debug' -- when something
> goes wrong stick a probe in there and figure the problem -- then
> leaving it there would be as unacceptable as a car mechanic giving you
> your keys with the hood open and parts lying around.

Console output isn't just a debug feature, though - and if you're
using it as such, you possibly should be using the logging module
instead. It's the most fundamental form of output. It plays nicely
with shell redirection and long pipelines, which means it
automatically lets you work with something larger than memory or even
disk. Imagine starting a pipeline with a decompression step (eg gzip
-d), and ending it with a tight filter (eg grep) - everything in
between could manipulate any amount of data at all, without caring
about storage space. Console output works in the REPL, works in the
default interpreter (other than pythonw.exe which suppresses it),
works across SSH... if your most normal form of output is a GUI,
that's not always true. Console output works without requiring any
other program, too, unlike (for instance) a CGI script, which needs a
web browser to interpret its output. There's a reason many languages
bless it with a keyword.


More information about the Python-list mailing list