-----Original Message----- From: edu-sig-bounces@python.org [mailto:edu-sig-bounces@python.org] On Behalf Of edu-sig-request@python.org Sent: December 13, 2003 8:54 AM To: edu-sig@python.org Subject: Edu-sig Digest, Vol 5, Issue 11
Send Edu-sig mailing list submissions to edu-sig@python.org Message: 1 Date: Fri, 12 Dec 2003 11:00:29 -0800 From: "Kirby Urner" <urnerk@qwest.net> Subject: [Edu-sig] Re: Python Programming: An Introduction to Computer Science To: edu-sig@python.org Message-ID: <E1AUsWf-0003Kt-Me@mail.python.org> Content-Type: text/plain; charset="US-ASCII"
I'm reading John Zelle's book, a real CS1 text book with exercises, using Python as the language.
This is an exciting book (see my concluding remarks below). I agree with the blurbs on the back. E.g. Russell May of Morehead State University writes "This text does an excellent job of filling a gaping hole in
Python community -- a textbook for an introductory computer science class... It is as good a text as I have read for CS1."
Zelle has a lot of experience teaching CS1, back to Pascal days. I
his sense of what belongs in a CS1 course in your average community or 4-year college. It's a fairly gentle slope by design, and Python makes it gentler.
What frustrates me somewhat is that CS1 doesn't really show off the full power of Python, and by the time we get to CS2 at Zelle's academy (and I'm suspecting this will be somewhat typical), we're on to Java. The reasoning is solid: real CS majors need exposure to a static-typed language, as well as to more than one language. I have no problem with this reasoning.
The frustrating part is this means cool CS2-level features of Python may not get much if any airplay. Syntax overloading is not taken up, and many OO concepts get only initial treatment (e.g. no discussion of class vs. instance properties/methods, nor of multiple inheritance). No list comprehensions, generators, regular expressions. No passing of functions as parameters to other functions. No numarray, nor much use of the standard library beyond math, random, string and Tkinter (which last is wrapped in a simpler module, graphics.py). No default or optional parameters.
Try-except *is* covered, as is eval() and docstrings.
Again, I'm not questioning Zelle's judgment re what's appropriate to CS1. He has long experience in this domain. He's fully aware of what Python can do, and just had to make these necessary cuts. It's probably somewhat painful to him as well, as when James Cameron (movie director) had to cut out reel three of 'Aliens' in order to have it fit the movie-house time constraints of the day (reel three is restored in the extended play version).
So let's assume a future in which Python is wildly successful as a CS1 language, but with this pattern of moving on for CS2, with the sense
Python has well-prepared students to tackle something thornier. Given this bright future, I still have this lingering concern that Python may eventually be typecast as a "beginner language" in the sense of being not sophisticated enough for higher level development.
As Guido concludes in his short forward: "Reader of this book, congratulations! You will be well rewarded for studying Python. I promise you'll have fun along the way, and I hope you won't forget your first language once you have become a proficient software developer."
I think it's this hope that I'm echoing as a concern. How will we ensure that Python continues to receive attention even *beyond* its considerable virtues as a beginner's language?
When I try to think about how to get deeper into Python within a CS curriculum, I come up with a few ideas:
(a) push more compsci content into the earlier grades so that CS1 might move more quickly from the beginning, and therefore get further. E.g. if a lot of the students coming in already know some Python, this would be ideal.
(b) keep the Python thread alive in CS2 even as Java is introduced, with the potential to bridge the two using Jython. This keeps Python around for contrast. This may actually be closer to Zelle's own approach, as he mentions at his website using Python as "pseudo code" for Java-based implementations (but then current Java doesn't do operator overriding, so some cool features of Python would still be missed using this approach).
(c) think about returning to Python in CS3, if there is such.
(d) return to Python in some of the more specialized classes having to do with graphics, computational geometry, statistics or other specific applications (a recommendation similar to (c) I suppose).
(e) keep jiggering with the CS1 curriculum to squeeze more in, even if students do not come in more prepared.
When considering option (e), my attention goes to the Point class. If all a Point does is hold x and y coords, then a class implementation seems
-- Dr. Toby Donaldson Assistant Professor School of Interactive Arts and Technology Simon Fraser University the trust that like
overkill in Python. You could get by with built-in tuples. But what if we make a Point slightly more interesting by making it a Vector? Then you can put in __add__ __sub__ __mul__ and __neg__, as well as length(self) and maybe even dot(self,other) and cross(self,other) -- do one in the text, leave the other for an exercise. Then there's conversion to/from polar/spherical coordinates.
Such a Vector might still be used as a parameter to Rectangle and Circle constructors, as in the current version, i.e. it could start out as a simple (x,y) container, and gradually mature as new OO ideas are mentioned.
Another approach would be to add a chapter called something like 'Looking Ahead' or 'Advanced Python', wherein a lot of these cool features were covered rather quickly and briefly, the intent being to give students a foretaste. Those students most enamored of programming and wanting to move more quickly, could be directed to this chapter and a for-further-reading section.
However, none if this is about detracting from the worth of the text as it stands. I believe Zelle is perfectly positioned to press Python's case, and is doing a very credible and creditable job of it.
He's clear in his intro that his goal is less to teach Python than to give an overview of important computer science concepts that students will re-encounter in just about any language. He's consciously eschewing certain Python idioms (list comprehensions?) in favor of a more generic approach because mastery of Python per se is not the main goal. I understand his reasoning.
Through his efforts, I'm hoping we quickly get to the point where "arguing for Python" as a CS1 language becomes a no-brainer, i.e. it's not even a point of controversy. I think this text moves us a big step in that direction. It's clear, it works, and it should easily go into multiple future editions.
Kirby
As much as I like Python, it doesn't walk on water. Arguing about CS1 languages usually degenerates into tedious religious battle where opposing sides argue the undeniable virtues of their language, and are generally disinterested in hearing about any other language. Yes, Python has lots of neat features, but so does every language, and arguing that Python's neat set of feature is better than language X's is a stalemate from the start. Productivity is far more important than language features, and the reason why Python trumps other languages is ultimately that it is so much easier to become productive in Python. I also think that if Python became known as the "beginner's language", then that would be a *much* bigger success than if it became the language of choice for CS1. Far more people program than take CS1 courses. Toby