re: Python Programming: An Introduction to Computer Science
-----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
I completely agree with Toby on this. I've already managed to make Python the CS1 language at Yorktown High, but it hasn't reached beyond the hard core geek community. If we really want to popularize it to a broader audience, it needs to fill the space taken by VB (at the high school) or what Logo used to do (at the middle school). On Sat, 2003-12-13 at 15:20, Toby Donaldson wrote:
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
-- Jeffrey Elkner <jeff@elkner.net> Open Book Project <http://ibiblio.org/obp>
-----Original Message----- From: edu-sig-bounces@python.org [mailto:edu-sig-bounces@python.org] On Behalf Of Jeffrey Elkner Sent: Saturday, December 13, 2003 12:28 PM To: Edu-sig Cc: Toby Donaldson Subject: Re: [Edu-sig] re: Python Programming: An Introduction to ComputerScience
I completely agree with Toby on this. I've already managed to make Python the CS1 language at Yorktown High, but it hasn't reached beyond the hard core geek community. If we really want to popularize it to a broader audience, it needs to fill the space taken by VB (at the high school) or what Logo used to do (at the middle school).
I guess I don't see how Logo makes a good case. It never went anywhere much beyond middle school. No Hubble stuff is done in Logo. I guess my question is, what's being used outside the "hard core geek community" that CS1 doesn't reach? VB? Or is it just that programming itself is still not a very widespread activity, using any language? In my view, we need more programming in the mathematics curriculum, which means recognizing that writing programs is likewise a way of writing mathematics. Or, more accurately, I'd say both kinds of writing are similar kinds of symbolic activity which deserve a prime spot in K-12 education. In the math curriculum, the real competition is not some other language, but calculators (I guess the TI programming language might count -- but my impression is more HS math teachers than students actually bother with the programming part). Numeracy, the equivalent of literacy with regard to prose and poetry, involves programming, mathematics, data visualizations, puzzle solving, logic, simulations, and other such. Numeracy and literacy connect at many levels. 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.
I wasn't doing that though. I realize there are lots of worthwhile languages out there and it pays to move on from Python. But it also pays to come back to it later, and if all the Python you ever get is in CS1, then you might not realize some of its power. This is equally true for some other languages. When I did CS1 (or the equivalent), the approach was to look at a different language every few weeks, or even more frequently. We used FORTRAN, PL/1, SNOBOL, APL, Assembler (simplified/simulated), and probably a few others I can't remember right now. I kind of liked this approach. Very eclectic. In the meantime, a lot of the lectures were about the guts of computers -- details about the registers 'n stuff. Of course this was long before Python. PCs hadn't even been invented yet (we did all our work on a mainframe).
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.
How is this different from discussing "neat features"? That you can use such simple syntax to do file I/O, or don't need a lot of type declarations, are *features* which lead to higher productivity. Likewise, generators and list comprehensions (which we might not get to in CS1), are productivity enhancers (there's also a PEP about combining these two in particular, which Martelli is pushing -- dunno what's it's status as of today).
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
I don't see these as particularly different either. CS1 is casting about for a good language to start with, for introductory purposes. C++ was definitely too hard, and Java, though better, is still sucking a lot of attention away from concepts, and onto syntax. So people in Zelle's camp argue that we should (a) look at so-called "scripting" languages for candidates and that (b) of these languages, Python is one of the best (other choices being Ruby, Perl and Scheme -- Scheme having a big advantage when it comes to having an already-developed CS1/CS2 curriculum). Kirby
Quoth Kirby:
Likewise, generators and list comprehensions (which we might not get to in CS1), are productivity enhancers (there's also a PEP about combining these two in particular, which Martelli is pushing -- dunno what's it's status as of today).
Generator expressions have generated (pardon the pun) a lot of interest and support and will be part of Python 2.4 with a syntax very similar to list comprehensions, but with parentheses instead of square brackets (and the parens are optional in some cases). Between this and the new itertools module (in the standard library) lazy evaluation becomes very accessible in Python (with all the benefits it brings for memory use and speed). --Dethe "All spiritual paths have four steps: show up, pay attention, tell the truth, and don't be attached to the results." Angeles Arien
participants (4)
-
Dethe Elza -
Jeffrey Elkner -
Kirby Urner -
Toby Donaldson