2013-03-21

Python rules!

My students chose to have a lecture on Python as the last lecture of the semester this winter, so I had to spend a few days on the language. I'd never programmed in Python before, but since I've programmed in heaven knows how many languages* I was able to grasp the basic idea of the language and run some simple stuff I found on the web. It seemed interesting, although it uses whitespace as a block delimiter. Ah, that was one of my traumas, writing the paper "When Whitespace Conveys Meaning" that got itself rejected from a number of conferences. Horrible languages that use this.

Anyway, one of my takeaways was that this is a great language for throwaway programming, even better than awk. A friend finally convinced me that I really needed a large file of random garbage interspersed with plagiarized sentences for testing the software systems. So I decided to give it a try this afternoon.

Together with my student researcher (who is studying computing but had also never programmed with Python before) we sat down at 11.50 am and started googling. I fired up the environment, and we started to play. We had spoken through the algorithm at lunch yesterday. At about 12.25 my other student researcher showed up (a doctoral student in philosophy) and tried to understand what we were doing. At 12.35 we had a working Python program to generate a paragraph of garbage from the on-board dictionary.

After lunch we spent about 15 minutes getting the rest to work, but made an error way back in one method. I had exam proctoring, so I started the exam and then spent an hour rewriting the program (including comments, like I bitch at my students to do), using good variable names, and finding the error. The end result is highly parametrized (far too high for a throwaway program), easy to read program. In about 3 person hours. Done and delivered, and we can carry on. And: it was fun, even with the stupid indentations.

So yeah, I now understand all the excitement with Python. It rules! But still, I rather don't want it used in safety critical or vital systems ...


----
* Basic, Fortran IV, COBOL, APL, awk, Perl, Pascal (various dialects), Occam, Ada, Java plus smatterings of report languages and database languages and compiler-compiler syntax and .....

No comments: