[Edu-sig] re: Python as a first-year programming language
Kirby Urner
urnerk@qwest.net
Mon, 28 Apr 2003 09:29:20 -0700
On Monday 28 April 2003 01:37 am, Toby Donaldson wrote:
> > >One of the problems I have about acceptance of Python is that the choice
> > >of first-year programming language is likely to be a group decision, and
> > >Python, for all its merits, is either unknown, or has a reputation as
> > >being "just a scripting language", or just a new version of BASIC. Such
> > >innuendos unfortunately often carry the day in many academic
> > >departments, as nobody but the teachers of the programming class will
> > >have time to actually evaluate the different languages. Who says
> > >academia has no pointy-haired bosses? :-)
Academics can be as prejudiced as anybody, and when it comes to Python, the
better faculties won't be trapped by their own ignorance, while the more "out
of the loop know-it-alls" will be. This is nothing new.
As you and I know, Python is not a new version of BASIC, isn't "just" a
scripting language, and a lot of people have heard of it and some it all the
time, in many walks of life. Some academics are just among the last to find
out.
So it's their problem, really, not ours (ok, ok, bad attitude: people on
marketing-python etc. continue to address these issues, but there's only so
far one can go with people resolute to remain clueless).
> I've used some of Norvig's code in a planner I've written in Python. It's
> been *great* for prototyping, like Scheme in many respects, but easier to
> read and write. Is there any way in Python to implement non-deterministic
> programming, e.g. for backtacking? It would be nice to be able to write
> something like this:
>
> def triple(a, b, c, n):
> a = choice(n) # choice non-deterministically chooses a number from 0
> to n-1
> b = choice(n)
> c = choice(n)
> if a**2 + b**2 == c**2:
> return a, b, c
You're asking if Python can do pseudo-random numbers? Non-deterministically
in what sense? The philosophers among us are bound to rage about whether
such a thing is even possible (maybe that cosmic ray just *had* to be there
-- whatever that means).
> More practically, what would help sell Python as a teaching language at my
> university is:
>
> - good textbooks for it, including exercises with answers, labs,
> self-tests, etc. (when there's 200+ students in one class, you need
> self-contained materials)
This is a legitimate need. That Deitel book, Python: How-To-Program uses this
format, but has other drawbacks. Very wide-ranging, yet too lazy to mention
Zope when getting into server-side programming.
On the other hand, there's the "book optional" approach. In the course notes
for CS11 at Cal Tech, the prof writes: "Python is sufficiently easy to learn
that you don't really need to buy a book to learn it."
> - explanations of the advantags it gives to "CO-OP" students, i.e.
> students who alternate school terms with work terms; the practicality of
> Python is key to selling it to student, parents, advisors, and employers,
> although a common argument is that we should be teaching the exact same
> languages that CO-OP employers use (I don't agree with that argument, but
> it's made all the time)
I'm of the school that it's best to learn more than one computer language, as
well as more than one operating system, because employers are all over the
map and have a variety of needs.
I met an executive with a simple need the other day. His web server was
kicking back answers to on-line survey questions in a somewhat unusable
format. He needed a utility to map answers, one answer per line (userid,
question name: value), to a spreadsheet with all questions in order across
the top, and those few answered per survey filled in as rows, userids down
the side.
The poor guy was trying to wrap his mind around coding such a thing in VBA
inside Microsoft Access, or as some kind of Excel macro. I came up with a
few lines of Python code in an evening, and because Python is a free
download, there's nothing more he needs. Now he's already thinking of
enhancements, plus is reading through the Python tutorial and appreciating
the flexibility that having a generic power tool like this is going to give
him.
In this example, we actually *are* talking "scripting language" and the truth
is: many Windows users aren't used to having one handy (as if DOS batch
files were ever really up to true scripting). HP/Compaq machines tend to
come with Python pre-installed these days, no doubt because some of their own
setup scripts use it.
> - explanations of how it impacts later traditional computer science
> courses, such as data structures and algorithms, operating systems,
> graphics, etc.; there's FUD among some that teaching students a "weird"
> language hurts them in later courses
>
> Toby
Python is hardly weird. It's rather straightforward and conservative, which
is one of the things people like about it. An agile language, high level and
object oriented. Weirder (but still fine languages, worthy of study) would
be Haskell, Ocaml, Rebol and J. Yet weird languages *are* used in the
business community. J for example: lots of Wall Street types use it for
financial analysis, along with it's older brother, APL.
Here's an example of a higher level algorithms course at UC Irvine that
happens to use Python. Just showing that some universities are going with
Python for these kinds of computer science courses, and not regretting the
decision: http://www.ics.uci.edu/~eppstein/161/
But still, if you're a CS major, you shouldn't think that learning any
*single* language is going to earn you that degree. I mean, to fully grasp
Python, you should be able to read its source code, meaning either C or Java
(both would be better, and if you know C, you should learn C++, whereas if
you know Java, might as well pick up C#). And you'll probably want at least
one course that focuses on LISP or Scheme, if your goal is to be
well-rounded.
The idea that a CS degree just means knowing some VB, a smattering of SQL, and
how to use Windows dialogs, is not worth catering to.
Kirby
PS: I was a philosophy major, not a CS major.