[Edu-sig] Python @ Education: What are your problems?

Guido van Rossum guido@python.org
Thu, 30 May 2002 08:44:26 -0400


> > - Lists, Tupels, Dictionaries included
> 
> Not bothered for our purposes. Lists are mentioned only very briefly
> in the context of the range() function, but we got away without
> discussing tuples or dictionaries at all. I say ``got away'' because
> we only have 1 day to teach programming(!) so almost anything we can
> avoid we will.

It seems your course is somewhat unusual in that apparently has a
heavy focus on scientific computing.  Not surprising given that you're
in the Physics program!  Usually data structures are a very important
part of a programming curriculum, and then lists and dicts are
crucial.  Does this mean you represent all arrays of numbers with
Numeric arrays?

> > - interpreter: Everything can be tested
> 
> I thought this was going to be a big deal. We designed the trial to
> give students almost a free reign over whether to use modules or the
> interpreter and *none* of them (out of about 40) used the
> interpreter. I think this might be due to the length of the programs
> they were writing (none more than about 100 lines), so they can
> derive practically the same amount of interactivity from repeatedly
> re-running the the program.  Perhaps when asked to write longer
> programs, when it becomes unwieldy to make changes for debugging
> purposes they might use it.

Interesting.  Could it also be that your students have reasonable
computer experience on Windows, where an interactive command line
interface is not used?

> We do seem to be having some trouble with the inconsistency of
> writing to stdout and file. To make things easier early on we have
> them write to screen using the print command. They can then separate
> abritrary variables using commas. However then they do
> fout.write(myfloat, myint, "Some numbers") and it doesn't work they
> get confused. It may be better to teach them to write to screen
> using sys.stdout.write from the start as that then provides a
> consistent writing tool.

Point taken.  It's just that sys.stdout.write is so cumbersome to
produce neat-looking output. :-(

I wonder what could be done to fix this?  Making write() act more like
print is impossible for backwards compatibility reasons (separate
print calls always insert a space or a newline between data, and
separate write() calls do neither).  Maybe we should add a file method

    f.printf("format string", args)

and a built-in function

    printf("format string", args)

and deprecate the print statement???

--Guido van Rossum (home page: http://www.python.org/~guido/)