Twenty Megabytes

Today I'm playing with Flickr to see what the buzz is about (and of course, to get some ideas for Divmod's photo-sharing features). I often think of blog narratives that involve photos. I'm going to post a few samples of ideas that I've had for months, but just haven't found a moment to upload.

I maxed out my upload ratio on my first night: 20M of photos goes really quickly.

By the way, I uploaded all the photos with FlickrUploadr, an unofficial GTK+ tool to upload photos written, inevitably, in Python.

what we need more of is surveys

I made some science

metaclasses: like candy for sociopaths

If you've ever tried to use __slots__, you might have noticed that it comes with a pleasant side-effect: it makes it impossible to assign extra, garbage attributes to your objects. While normally not a serious problem, objects with extra, unintentional crud stuck to them can make object databases hell to work with as you struggle to figure out where it came from or why it is in your database but not in memory. Therefore, this semantic feature is handy in addition to reducing the memory footprint of objects if you have large numbers of them lying around.

If you've noticed this, you've also probably noticed that it is damn near impossible to use __slots__ because you have no control over what slots are used from your base classes.

Here is a solution to this problem that I have been working on for a while: SlotMachine. While it breaks isinstance - you weren't using isinstance anyway, right? - it does do the sane thing that you would expect a cooperative __slots__ implementation to do; you can subclass from random other classes (provided that you properly specify all their attributes as slots on your object) and other SlotMachines, and even other objects that define __slots__, without giving up the explicit specification of attributes or the ability to inherit from things.

I'll add some more comments to that file later tomorrow, I think.

Releasery

We managed to release something yesterday - Pyflakes, a tool similar to PyChecker but about a zillion times faster and provides fewer useless warnings. The author is Phil Frost, one of our developers and the lead maintainer of the Unununium OS project. Pyflakes was previously available through his home page, but we've started hosting it on divmod.org in the hopes that it can get some wider exposure and use and raise the average index of Python code quality throughout the universe.

math is for nerds

Can you guess what this is?



Posted for the benefit of Mr. Mesozoic