I don’t make it to many of the Central Ohio Linux User Group meetings but I happened to be at the one where Catherine Devlin stopped in to announce an upcoming Python conference in Ohio, strangely enough, named “PyOhio.” That was in 2008 and, though it sounded interesting, I couldn’t make it to the conference. Nonetheless I did remain interested and was able to attend the first day, July 25th, of the two day conference this year.
PyOhio 2009 was held in a giant, oddly-shaped, glass-lined, marble-shingle-clad, cement block named Knowlton Hall on the OSU campus. The building is strangely proportioned. There are steps for giants and seats for little people. In fairness, it was a good place for the conference (except for that UPS that apparently lost power behind some locked door beeping constantly all day). The giant steps are meant for sitting on (not a special staircase for the basketball team) and college students typically don’t need as much seat space to be comfortable as I do. I just don’t share architectural aesthetic with the designer of the building.
Getting Started with Django
The first presentation I attended was an introduction to Django by Alex Gaynor. According to the Django web site “Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.” Alex did a nice job introducing Django. He has obviously worked with it a great deal as evidenced by the live demo he did at the end. The live demo didn’t go perfectly but it went well. It takes courage to do an impromptu live demo since it’s a huge opportunity to crash and burn.
According to Alex, Django doesn’t really use the Model-View-Controller (MVC) pattern precisely but rather uses a pattern more like Model-View-Template (or maybe Model-Template-View – MTV). Django is “opinionated” to be more secure by default, you have to work harder to do things the wrong way (the old “falling into the pit of success” thing). Django views render templates. Templates use a custom template language within HTML. You define base templates that then reference child templates (it’s probably the other way around: child templates reference base templates, but I’m not sure – sorry). In Django a “project” is a web site and an “application” is an individual component of a web site. To learn more about Django (ignore what I’ve written here and) check out The Django Book online.
Django looks very interesting and appears to do a lot of the heavy lifting for you. I hope to explore it on the side sometime over the next year. I’ve done some work with PHP recently, a small project that didn’t use an existing framework. With frameworks like Django available it doesn’t make sense to not use one on anything but the simplest web project (and even then, those “simple” projects tend to become not so simple once you let them out of your head).
Python for Java Developers
The second session I went to was Python for Java Developers presented by Eric Floehr. Eric works at 3x Systems and has been working with both Java and Python. He is also working on starting a Python user group in central Ohio.
Eric talked about the similarities and differences between Java and Python, starting with the histories of the languages. He noted that James Gosling the creator of Java and Guido van Rossum the creator of Python are both cool guys.
The Python language was originally developed for the Amoeba distributed operating system developed by Andrew Tanenbaum who also developed Minix, the inspiration for the Linux kernel (apparently a rather influential fellow).
Eric also mentioned:
- ipython
- WingIDE
- Eclipse with PyDev (I wrote “PyEnv” in my notes but I think it’s PyDev)
- Virtualenv
- logging module (like log4j).
- unittest
- Doctest – Interactive session output text in comment executed as a test.
Python Operator Overloading
Neil Ludban talked (a little too quietly) about operator overloading in Python. He showed how the special methods, with names that begin and end with double underscores, implement operations on objects in Python. For example, the statement x + y
is internally passing y to the __add__ method of object x like this: x.__add__(y)
I have a few terse notes about some things I want to explore further (my note taking diminishes as the day goes on):
Equality is subset of Sortable
x[y] = x[y.__index__()]
__repr__()
__unicode__()
bool(x); __nonzero__(x)
import operator; help(operator)
PEP-3119
Explore: slice, functools
with statement (PEP-343) implicit try/finally block
Attributes versus properties?
f(*iterable, **mapping)
There. Isn’t that helpful?
Python Not Harmful to CS Majors
Bill Punch from Michigan State University talked about the decision to replace C++ with Python in their CS1 class and the results thereof. Python seems to let them spend less time teaching the tooling and more time teaching problem solving. Bill asked us to try to remember what it was like to be a first time programmer (admittedly a hard thing to do after so many years). I appreciate that because over the years I have tried to write software that is accessible to non-computer people, and to do so requires seeing the use of the software from their perspective as best you can.
I enjoyed Bill’s description of “Dung Beetle Programmers” too: Instead of really understanding the program they are writing, and the problem they are solving, they just pile on code creating a ball of dung. Then to get it to work they pile on more for a bigger ball of dung. Finally they end up with an inordinate attachment to dung hence they don’t discard any bad or unnecessary code.
From the statistics they collected as students have progressed past CS1 since the switch to Python in fall 2007 they conclude that Python has not hurt the CS program. On the other hand, there doesn’t seem to be statistical evidence of a great improvement. Bill reported that he has seen a positive change in other ways. Students have come to him with stories of how they have used Python to solve real-world problems.
Form to Database Web Development
I caught the end of a session by Gloria W. Jacobs that I would like to have seen more of. Just a few links from that:
- from web.py import template
- cherrypy
- SQLAlchemy
Game Development with Python and Pyglet
The quick and witty Steve Johnson talked about game development with Python. Unfortunately I only caught the end of this one as well, so only a few links:
Lightning Talks
The official PyOhio schedule ended with lightning talks:
Catherine Develin showed off some of the cool stuff you can do with sqlpython, an open source command line interface to Oracle she contributes to (and I believe has taken the lead on).
I failed to get the name of the gentleman who spoke on scaling and suggested using log shipping to update a set of read-only databases from a single write-to database. The read-only databases feed web servers.
Joe Amenta talked about Python 3.0 and a project called lib3to2 he’s working on to help you port backward to the 2.x Python interpreter should you need to do that.
Steve Johnson – funny slides to remind us that the name comes from Monty Python, not the snake.
zsh guy showed us the power of the command line.
Disease modeling in Python guy had scary diagrams where the end result was death (sort of like – life). High powered Python libraries: SymPy, NumPy, SciPy, and WxPython for the GUI.
Gloria W. Jacobs talked about Kamaelia.
Somebody talked about introspection in PyGame but by then my note taking was almost as bad as my memory at the end of a learning-packed day. After the conclusion of the scheduled sessions there were open spaces, sprints, and other evening activities. I couldn’t stick around for those this year.
Wrapping Up
Watching the other attendees working with their notebook PCs (saw a lot of Apples there) made me think I’d like to have some sort of wee PC with good battery life and mobile broadband. My spiral bound steno pad from Wal-mart just didn’t afford me any coolness or connectedness.
I want to thank all the folks who made PyOhio happen. I’d like to thank Catherine Devlin in particular for her role in organizing and spreading the word, and doing so with great enthusiasm. Assuming there will be a PyOhio 2010, I hope to be there for the whole event and maybe even contribute in some way. I don’t know that my Python skills will be up to presenter level by then but maybe I’ll at least come prepared to do an open space of some sort.