E-Scribe : a programmer’s blog

About Me

PBX I'm Paul Bissex. I build web applications using open source software, especially Django. Started my career doing graphic design for newspapers and magazines in the '90s. Then wrote tech commentary and reviews for Wired, Salon, Chicago Tribune, and others you never heard of. Then I built operations software at a photography school. Then I helped big media serve 40 million pages a day. Then I worked on a translation services API doing millions of dollars of business. Now I'm building the core platform of a global startup accelerator. Feel free to email me.

Book

I co-wrote "Python Web Development with Django". It was the first book to cover the long-awaited Django 1.0. Published by Addison-Wesley and still in print!

Colophon

Built using Django, served with gunicorn and nginx. The database is SQLite. Hosted on a FreeBSD VPS at Johncompanies.com. Comment-spam protection by Akismet.

Elsewhere

Pile o'Tags

Stuff I Use

Bitbucket, Debian Linux, Django, Emacs, FreeBSD, Git, jQuery, LaunchBar, macOS, Markdown, Mercurial, Python, S3, SQLite, Sublime Text, xmonad

Spam Report

At least 236562 pieces of comment spam killed since 2008, mostly via Akismet.

The "path" module

Somewhat belatedly I've started using Jason Orendorff's path module for Python. It's great. Here's a comparison with the stock os.path facilities, grabbed from Jason's site:

# with os.path.walk
def delete_backups(arg, dirname, names):
    for name in names:
        if name.endswith('~'):
            os.remove(os.path.join(dirname, name))
os.path.walk(os.environ['HOME'], delete_backups, None)

# with path
d = path(os.environ['HOME'])
for f in d.walkfiles('*~'):
    f.remove()

The second snippet is not just shorter, it's easier to read and easier to write. I'm writing some code to recursively process a tree of short text files (Blosxom entries), and the path module is a godsend. If you're curious, see the description and examples on Jason's site; he also posted some interesting comments on Ian Bicking's blog about the design of the module.

I gather that there was significant interest in getting some version of this module included in Python 2.5, but I don't see any mention of it in the release notes. There's PEP 355 and a python-dev discussion from January. But unless I missed something (I'm still mostly using Python 2.4), it's not in 2.5 in any form. Here's hoping it makes it into 2.6...

Update: Bummer. Dead.

Thursday, September 28th, 2006
+
4 comments

Comment from Paul , later that day

Good find -- thanks, Lawrence!

Comment from Lawrence Oluyede , 1 day later

GvR just said the path module will not get into Python so... that's it.

Comment from Paul , 1 day later

Yeah, I saw that and added my "bummer" update link above. Oh well. I guess it will just be part of my own little library for now.

Comments are closed for this post. But I welcome questions/comments via email or Twitter.