home ¦ Archives ¦ Atom ¦ RSS

Nottingham: Python Dicts as API

Mark Nottingham has been considering the usage of Python dictionaries as interfaces to computing services. First, obliquely, is the usage of dicts for navigating XML. Secondly, he's actually putting the Web in a dictionary. All right, so I'm a little late to the party. Sue me.

For the uninitiated, in most scripting languages it's quite easy to hijack the associative array/hash table syntax and hide other datatypes or procedures behind it. So for example it becomes easy to say something like web['www.cs.northwestern.edu'] to retrieve a Web page.

I did get a tad bit inspired and started putzing around with putting the del.icio.us API in a dictionary. No code as of yet, but the results look promising. Just to be a bit more of a tease, for another project, I combined dictionaries and Python's shelves for persistent storage. Putting it all together, I think there's a relatively elegant way to provide a Python module which makes accessing del.icio.us quite Pythonic, but also provides caching and persistence. The whole package would be very convenient for building friendly del.icio.us clients on top of.

© Brian M. Dennis. Built using Pelican. Theme by Giulio Fidente on github.