Things a silly non-programmer like me has used Python for

A few example of things I've done with Python over the years, some just for fun and some to solve problems that I didn't know how else to solve:

Mathematics

Done a lot of mathematical stuff in Python; go back to back for a hint of how one can easily construct quite abstract mathematical gizmos. I'm going to refrain from listing them all - you guys have an idea what mathematics is.

Just going to mention one specifically; it's the one that it seems to me has the highest "keen" factor: We all know that the n-th Fibonacci number is given by the formula

Fib(n) = (1/Sqrt(5))(((1+Sqrt(5))/2)n+1 - ((1-Sqrt(5))/2)n+1).
One of the fun parts of teaching 3013 is deriving this formula by diagonalizing a certain matrix. Years ago when I was stupid(er) I used to tell the kids that you could use this formula as an efficient way to actually calculate Fib(n) for large n. Of course that's nonsense; if one is using standard doubles then roundoff error swamps the result when n gets to 15 or so.

The keen thing: Last summer I made a Python thingie that actually evaluates Sqrt(5) exactly, as an element of

Q[x]/<x2-5>;
this means I can use the formula above to calculate Fib(n) for large n! (On a 2000GH/512MB machine I get Fib(10000) "instantaneously" and Fib(100000) in what seems to be a little more than one second.)

You gotta admit that's keen...

Internet stuff

poplib.py

Last summer, because of a certain worm, I found I was getting about 200 MB of spam daily! That was 2000 messages a day, each containing a 100KB attachment.

This was a problem - I couldn't delete the stuff using my email program even if I wanted to, because Eudora simply choked on an mbox that size. (Why it downloads everything all at once instead of just the headers I couldn't tell you.) I saw Procmail solutions posted on the internet, but that didn't work because we weren't running Procmail... But it was _very_ easy, using the Python module 'poplib', to write a little Python script that reaches into my mbox and deletes all the messages above a certain size. Still using it, although it's now only about 20 or 40 of those messages daily.

urllib.py

A few years ago Dr. Alspach told me that he was surprised he couldn't find a Perl script that would crawl a web site looking for broken links. A few days later I gave him a simple Python script that did exactly that - he seems to have used it for a few years, for example when he was maintaining the graduate program's home page, I don't know whether he still has any use for it.

httplib.py

Years ago I had a problem: If I tried to download a large file from a website (at home) it never worked, because I never stayed connected long enough. These days connections are more reliable and web browsers are smart enough to resume an interrupted download where it left off, but back then it was a problem. I made a Python script that was smarter than Netscape in this regard; I could download part of a file and then after getting disconnected download the rest of it without going back to the start. (This one took a little research in the HTTP specification to figure out what requests to send, but once I knew what I wanted to do it was no work at all to get the Python httplib module to do it.)

General programming

Rolodex.html

All of the html code for rolodex.html, as well as the pages it leads to, like Faculty, Faculty Pictures, and Aichele, is generated by Python scripts. (Each year I get an Excel file with the new data from the office; I open it in Excel and save as csv, then a little bit of Python converts that to my data format and generates all the html.)

Code generation

Every once in a while I find myself using Python to generate things like TEX or Postscript code. For example... um, I can't find the example I was going to give right now, never mind.

Bookeeping

I use Python for things like keeping track of student's grades, keeping track of the budget for the Kerr Committee, etc.

Now, those who feel this is a little silly since I could just use a spreadsheet may well have a point. But I don't know how Excel works. (Also, for example, every once in a while you see people post questions online about how to do something in Excel - using an actual programming language whatever I want to do I just do it. Also seems silly to wait five years for a huge application like Excel to load when I just want one little bit of information. And Python is free, while Excel users are supporting the Evil Empire of Redmond...)