A blog by Gary Bernhardt, Creator & Destroyer of Software

PyCon 2007: The Untold Stories

27 Feb 2007

Most of the PyCon posts are about the sessions, so here are some of the interesting things I did outside of the scheduled talks. I have pictures for many of them thanks to Mike Pirnat's diligent photography.

Pagoda CMS

Brian, Chris, and Ian demoed Pagoda, their upcoming open-source CMS. It's very user-centric, and they're spending a lot of effort on the user experience. Even though I don't use CMSes, I'm excited about this project because I'm so sick of crappy UIs. Peoples' responses seemed positive, but I think some people were disappointed that Pagoda takes the easy-to-use approach rather than the kitchen-sink approach. That's ok; that's why we have Zope – the kitchen sink is there for the taking!

Pagoda CMS Open Space

Python Is Basically DOS, Right?

I headed up to my room to grab my hoodie, and on the way back I was in the elevator with a 40ish couple. They asked me what this conference was about; I told them it was about Python, which is a programming language. The guy asked me whether "that's anything like DOS". It was kind of funny, but mostly just jarring. After being in close quarters with lots of smart programmers for 2 days, it was weird to suddenly talk to someone whose computer experience apparently began and ended around 1990.

The Mysterious Ellipsis

Dave, Mike, and I were at the hotel's bar, and the topic of Python's ellipsis operator ("...") came up some how. From the grammar in the slicing docs, we could tell that the ellipsis could appear in slices, but we couldn't trick Python into taking it without throwing an exception. I figured it out later – in a slice, the "..." token is just translated into an "Ellipsis" object:

>>> class Foo:
...     def __getitem__(self, x):    
...         return x
... 
>>> f = Foo()
>>> f[1:2:3]
slice(1, 2, 3)
>>> f[...]
Ellipsis
>>> f[1, 2, ..., 100]
(1, 2, Ellipsis, 100)

Apparently, it's mostly used for numeric stuff like Numpy. I definitely understand Python's slicing much better after that confusing night.

Gary and Dave Hacking

Mischief on The Open Space Board

Brian and Chris posted a "Python in The Adult Entertainment Industry" card on the open spaces board with my name on it. It was up for about 20 minutes before Brian pointed it out to me and I took it down. Hopefully, I escaped without too many prominent Python hackers associating me with pornography.

I have to wonder whether anyone saw that card and was actually interested in going to the session. Maybe Chris and Brian's silliness prompted an interesting discussion of Python and porn somewhere...

Mischief on The Open Space Board

RESTDB

The open space I actually did lead was on "REST, Databases, and RESTful Databases" rather than pornography. Unfortunately, I dove into explaining RESTDB right at the start. It turned out that not everyone was familiar with REST, or convinced of its usefulness, or both. So, we ended up talking about REST for the second half. I think the session would've been more useful to everyone involved if we'd discussed REST first, then moved on to RESTful databases. I'm not sure how much everyone else got out of it, but I learned a lot about how to explain what RESTDB is and why we might want it.

RESTDB Open Space

Django vs. The World

I didn't fly back until Monday, so I was still there on Sunday night. Most of the people who were still there were staying for the sprints, so the conference area was pretty quiet as everyone quietly hacked away (with the exception of the Wii room).

I was on my way back to the "quiet room", which was full of Django guys. On my way there, a big group of people appeared and asked where the Django guys were. I pointed them towards the quiet room and joined them on their way there. The group was made up of TurboGears guys, Pylons guys, Paste guys, and some that I didn't recognize. They busted into the Django room and caused some friendly commotion, with one notable result being this post on Ian Bicking's blog. I'm pretty sure that EWT's bathtub full of alcohol (pictured) was a factor in this incident.

Lots of Beer

Magic URL Mapping

After the ruckus in the quiet room ended, I hacked up some crazy URL mapping code based on an experiment Brian did a while back. Here's a controller defined using it:

class UserController(_/'users'/User):
    def get(self, user):
        return dict(
            email=user.email,
            name=user.name)

The _/'users'/User part defines the controller's URL, and User is actually a RESTDB resource type. So, for example, if someone requests /users/Bob, this controller will be invoked and the Bob RESTDB resource will automatically be retrieved and passed in. This works for multiple records, so you could also have more complex controllers like:

class BlogController(_/'users'/User/'blogs'/Blog):
    def get(self, user, blog):
        assert blog.user == user # yep!

BlogController would be called for URLs like /users/Bob/blogs/TheBobBlog and, once again, both Bob and his blog would automatically be pulled out of the database. Of course, it's fully RESTful (hence the get method).

Keep in mind that this is just a silly experiment; please don't freak out because I'm overloading division to produce a URL mapping object that I then subclass. (Although, to be honest, the code isn't that bad; it's only about 60 lines long.)

Overall, PyCon was awesome, and I'm really glad I went. It's going to be in Chicago next year, so I won't have to lose two full days to travel (awesome!)