It Fits Your Brain: the Ninth Annual International Python Conference

Extra, extra, read all about it.

2001 is also the year of Zope Alternatives. My favorite discovery was Webware. Chuck Esterbrook developed this modular web application server out of frustration with the monolithic nature of Zope (see Chuck's presentation for an overview). The main component is WebKit, which allows Python packages to be servlets. Here's a minimum servlet:

from WebKit.Page import Page
class index(Page):
    def title(self): # This will go into the HTML <TITLE> tag.
        return "Important Message"
    def writeBody(self):
        self.writeln(" This web site is not here yet.")

You can call this "" and invoke it in the browser as, index or even as the directory. The file must contain a class with the same name as the file, and this class is normally a subclass of Page. CGI parameters and cookies are as simple as:

        req = self.request()
        fname = req.field('fname')
        bgcolor = req.cookie('bgcolor', '#FFFFFF') # With default.

You even get a session object for free:

        sess = self.session()
        name = sess.value('name')
        sess.setValue('x', 5)

The application caches servlet instances for later reuse. It interacts with Apache or AOLserver via a CGI interface or a web server module (e.g., mod_python). Two other plug-ins deserve mention. Python Server Pages is for those who prefer embedding Python commands in HTML files à la ASP or PHP. MiddleKit is an object-oriented intermediary for database access.

Other Presentations and Exhibits

I wish I had space to discuss some of the other talks. Eric Raymond presented CML2, his Linux kernel configuration system. Others talked about internationalizing Mailman using GNU gettext, weak references, writing Microsoft .NET programs in Python, etc. One notable module mentioned is pyperl), which allows your script to call Perl functions.

In the hallway were vendor exhibits, including ActiveState's Python Cookbook (a free interactive FAQ), and the Toilet Paper display.

Toilet Paper is an automated water closet. No, there wasn't a loo in the hallway, just a diagram of the privy. A 486 computer running Slackware sits alongside the porcelain bowl. It detects visitors outside via a motion detector and has sensors for toilet seat position, light switch position, etc., and then plays appropriate music for each state. It fetches selected web pages, extracts the headlines and displays them on an LCD screen. Toilet also has an external web interface to request songs, report on its usage history (scary) and send messages to the LCD screen.

Closing Keynote

Bruce Eckel is the person who invented the "Python Fits Your Brain" slogan as well as last year's "Life is Better Without Braces". He's also a well-known C++ and Java design consultant. In his closing keynote, Bruce presented the top ten reasons why he loves Python:(See the Powerpoint slides from Bruce's presentation.)

10. Reduced clutter.

9. It's not backward-compatible with other languages. (This came with some hilarious one-liners: "C++'s backward compatibility with C is both its strength and its bane"; "Java causes repetitive-strain syndrome"; "Perl is compatible with every hacky syntax of every UNIX tool ever invented"; "C# and Microsoft .NET are backward-compatible with Microsoft's previous marketing campaigns"; and "Javascript is not even compatible with itself".)

8. It doesn't value performance over my productivity.

7. It doesn't treat me like I'm stupid. Java insists operator overloading is bad because you can make ugly code with it. Bruce observes, "And we all know there's no ugly Java code out there."

6. I don't have to wait forever for a full implementation of the language.

5. It doesn't make assumptions about how we discover errors.

4. Marketing people are not involved in it (yet).

3. I don't have to type so much. But what I do type is the right typing.

2. My guesses are usually right.

1. Python helps me focus on my concepts rather than on fighting with the language.

His idea for the next Python slogan? "No warranty, not fit for any particular purpose." We'll see about that next year.

Conference proceedings and slides have been posted to the Python9 web site.

Mike Orr writes web applications at SSC, edits Linux Gazette and does other sysadmin stuff. He doesn't usually write articles, but he makes an exception for Python because it's so cool.