The field is becoming increasingly crowded: the second edition of Al Sweigart’s Invent Your Own Computer Games With Python is now available. It’s aimed at kids and teens, but doesn’t condescend — I’m looking forward to going through it.
Practical Programming, Python, Teaching
Adding to this meme, here are some PyCon 2010 talks I’m particularly looking forward to:
- “Creating RESTful Web services with restish” by Grig Gheorghiu.
- “Python Testing Patterns”, by Aaron Maxwell.
- “To relate or not to relate, that is the question”, by Mark Ramm.
- “Turtles All The Way Down: Demystifying Deferreds, Decorators, and Declarations”, by Glyph Lefkowitz.
- “VisTrails: A Python-Based Scientific Workflow and Provenance System”, by Juliana Friere.
- “On the Subject of Source Code”, by Ian Bicking. (I have strong opinions
See also here, here, and here.
Python
71 people have answered our questionnaire about Practical Programming. Here’s some of what they told us; I’ll summarize the questions about use of online programming resources and what we could do differently next time in a subsequent post.
Read more…
Books, Practical Programming, Python, Teaching
In response to a question about what it’s been like switching to Python as a first-year programming language, Paul Gries wrote the following. It might be of interest to other instructors who are thinking of changing over.
And in related news, we’re compiling errata and solutions to even-numbered exercises for a fresh printing of Practical Programming. We’re pleased with how well it’s doing; in particular, we’ve been pleasantly surprised by the number of inquiries we’ve had from people who are home schooling. If you have questions, suggestions, or experiences to share, we’d love to hear from you.
The switch to Python was quite smooth, except for the following items:
- We decided to write a textbook because we didn’t think we could live with the options at the time.
- We decided to use Mark Guzdial’s excellent multimedia approach, but ended up almost completely rewriting his media module to use standard Python instead of Jython and had many issues with his development environment. Mark had a proof of concept that we worked from, but it used Java naming conventions and since it was designed and written by undergrads it needed a lot of cleaning up. You can find installation instructions for all of the packages that we use at . A team of about 4 people worked roughly 1 day a week throughout the summer in 2007 to put together the lectures, assignments, labs, and tests, and we’ve been refining that since then.
We love most of Python, especially the clean, readable, minimal syntax. However, there are several Python gotchas, and we were bitten by almost all of them. Here are some of the major ones that confused either students or instructors:
- There are no good GUI packages; Swing was at least teachable, but Tkinter has lots of warts and none of the others (e.g., wxPython, PyQt) seem to be usable on all three major OSes. We’ve dropped Tkinter this fall in favour of EasyGUI, which has major limitations but is much more teachable.
- It’s hard to know when to stop. List comprehensions, for example, are really cool and natural, but they make a surprising number of problems too easy and allow students to avoid writing loops. We show them toward the end of our intro course but don’t require the students to use them.
- Aliasing is surprising and comes up naturally and even accidentally, especially in lists. This is not necessarily Python-specific, but it sure comes up more in Python than it did in Java.
- Default values for parameters are created once. Students (and some instructors) hate this.
- Simple classes are harder to teach than in Java. Also, “self” confuses a large subset of the students. Since dictionaries are so accessible they do whatever they can to avoid using and understanding classes.
- Global scope is hard to explain: it’s actually module scope and not global, and in the three examples below there are different behaviours; the last example in particular really confuses students. They do all of these things naturally, so we can’t prevent them getting confused.
# Example 1
i = 1
def f():
print i
f()
print i
|
# Example 2
i = 1
def g():
i = 2
print i
g()
print i
|
# Example 3
i = 1
def h():
print i
i = 2
print i
h()
print i
|
- More scope: nested functions baffle students.
On the positive side, some students LOVE putting functions into dictionaries and getting rid of huge if/else statements. They also find passing functions as parameters to be natural; we introduce this idea to write a timing function that returns how long its argument runs. This is a lovely thing to do when we get to searching and sorting.
In CS2, we’re struggling with how much information hiding to do; we’re conflicted about whether __var plus set_ and get_ helpers is what we should do or if we should get into properties. We’re leaning toward the former, but we’re not certain.
Practical Programming, Python, Teaching
Via several people, a nice intro to programming for children called Snake Wrangling for Kids, available free.
Python, Teaching
As well as the Software Carpentry course we’re running in Toronto July 13-31 this year, the Physics department is organizing a one-week Python Boot Camp July 13-17 for $375 (Canadian). Who knew we were so fashionable?
Announcements, Python, Software Carpentry
Python 3.0 (final) has been released — yay, and congratulations to everyone who helped build it. It includes a lot of welcome changes [1], and I’m looking forward to switching—but not yet. Our “intro to CS in Python” textbook (now in beta at Pragmatic) and our port of DrProject to Django are both going to stick to 2.*, at least until mid-2009. It’s no reflection on Py3K—we’re just juggling enough other balls that adding more technical novelty to the mix would greatly increase the risk that everything would come crashing down. It’s the same argument I’ve had with students who want to switch from Subversion to Git/Arch/Bazaar/Mercurial/whatever: sometimes, it’s better to concentrate on the task at hand and let other people find the potholes for you.
Congratulations once again to the whole Py3K team!
[1] Very glad they added literals for sets, like {1, 2, “three”}; still disappointed that people still have to write the empty set as set() (because {} means “empty dictionary”). Maybe in 4.0…
Python
I left Toronto for Austin mid-day Wednesday, and got back at midnight last night. Lots happened in the interim, so here’s a linkandthoughtdump (which I bet actually is one word in German):
- Gave a talk about Beautiful Code to the Austin Python Users’ Group Wednesday at Enthought‘s swanky offices. (They’re the kind folks who provide web hosting for the Software Carpentry course.) About 27 people in attendance, and good discussion afterward; was grateful to Travis Vaught and Sergey Fomel for rides from the airport and to the hotel respectively.
- Gave another talk titled “HPC Considered Harmful” at the Texas Advanced Computing Center‘s Second Annual Scientific Software Days. I was a bit nervous about telling people at a supercomputing center that focusing on massive parallelism and peak performance is wrongheaded, but there were a lot of nodding heads.
- I made lots of notes from two other talks that I want to follow up on at some point:
- Robert van de Geijn’s FLAME system lets you draw matrix operations, then automatically generates the corresponding high-performance code. It’s a great example of a real high-level programming tool for scientists (and yet another special case of what a real extensible programming system would support).
- Eric Jones (also from Enthought) talked about a tool they’re building that watches changes to variables in Python programs, and automatically generates interactive plots of their values. It sounds simpler and less impressive than it actually is; I’ve asked him to put together a screencast, and I think you’ll be wowed—I was. (Later: Steve Eddings from The Mathworks sent me a link about data linking in MATLAB, complete with a video tutorial.)
- At roughly the same time, half a world away, Diomidis Spinellis presented a study comparing the code quality of Linux, Windows, OpenSolaris, and FreeBSD. Very cool work; wish I’d been at ICSE’08 to ask questions.
- Meanwhile, Dmitri Vassiliev, who is continuing his work on SlashID this summer, has discovered that generated code is next-to-impossible to debug. Not to be a one-note symphony or anything, but I said in that same article about extensible programming systems that the real challenge is not extending notation, but creating extensible debugging tools so that those notations and high-level representations can be fixed when they break. Robert van de Geijn doesn’t think FLAME needs a debugger; respectfully, I disagree.
- Science in the Open has a plea to scientists to make their raw data available, motivated by yet another irreproducible result.
- Kosta Zabashta has posted early thoughts about integrating IRC into DrProject. (Gray on black? Kosta…your design skills rival mine…) I need to tell him that DrProject’s RPC module doesn’t handle tickets because Jeff Balogh is going to replace the entire ticketing system with an extensible one this summer, using his Dojo Form Editor as a front end…
- Elisabeth Hendrickson has thoughts on automating tests for legacy web applications. Students, take note.
- Thanks to Nick Jamil and others, we have instructions for installing DrProject on Windows. Yay!
- Everything old is new again, including Ada and the Bletchley Park Colossus.
And then there’s this:

Thanks again to Sergey Fomel for inviting me down, and for introducing me to the reproducible research community—I’m looking forward to many more discussions.
Beautiful Code, DrProject, Python, Research, Software Carpentry
Via Mike Fletcher:
We will be holding our regular PyGTA meeting next Tuesday, the 16th of October. Topic proposed is: Continuations, Tasklets, Co-routines and Micro-threading. Be the first on your block to be able to say “I broke my brain with Python!” This is the ever-so-neat deep-dark computer-science-y stuff that everyone loves to expand their minds around while drinking copious quantities of caffeine.
As usual, we’ll gather at the lovely Linux Caffe at the corner of Grace and Harbord in downtown Toronto, just one block South of Christie station. We’ll aim to start the meeting at 7:00pm.
More details at:
http://www.pygta.org/
Python
After last week’s sprint at Google, the first alpha of Python 3.0 is available. This is the release that breaks backward compatibility in order to get rid of some warts—not enough and not enough for some people, but it’s still a big step forward for the languages. Kudos to all involved.
Python
Recent Comments