Main

January 25, 2007

Sawing off the handle

Fantastic comment on this excellent blog post:

Some people I know saw off the handle of their toothbrush when they go mountain trekking. It sames about one gram of weight and makes brushing your teeth so much more tedious.

The same goes for removing the explicit self. It saws off a small weight, but every time your mind needs to examine some code, it will have to generate that self, making the job more tedious.

The original post is worth reading — language bigotry, like all bigotry, is easy to fall into, but it’s bad thinking. Don’t do it kids.

November 03, 2006

The Lyricator

Paul Lamere writes about The Lyricator, some python code for working out the mood of a piece of music.

For Sleevenotez we’ve been thinking about genres a lot - it’s a difficult problem, since it’s so subjective. I wonder if this could help?

October 29, 2006

Ruby's partition

A very nice little function from the Python Cookbook: group and partition. These functions really ought to be in itertools (and IMO everything in itertools ought to be in builtins).

Just another example of how Ruby and Python are far more similar than different :)

October 17, 2006

Enthought Traits

A reference on Dr Dobbs Python-URL pointed me to Enthought Traits, which look very interesting.

This sort of idea crops up all over the place, but is rarely as well focused. This is part, for example, of Plone’s Archetypes and of Nevow’s Formless.

It’s good to see it separated from the persistence machinery (a fault of Archetypes IMO), and good to see the separation of “View” and “Typing and Validation” (a fault of Formless IMO). This is quite a specific set of responsibilities that Trait’s provide, and they seem to be well factored.

August 31, 2006

You learn something new every day

And today's lesson was... basestring. The base class for str and unicode. Can be used with isinstance to test if you either str or unicode, rather than hacking around. It was definitely news to me, anyway...

August 02, 2006

Kernighan strikes again

A great quote. spotted by Richard Jones:

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian Kernighan

July 31, 2006

Restructured Text and Trac

Recently I've come to love restructured text. It excels at everything it tries to, without being overcomplicated. Our heavy reliance on subversion for version control, sharing and merging means that we need a non-binary format where possible for documentation; that combined with the many tools to convert it to other formats (including our own to convert from ReST to PDF which I promise we will publish soon) and suddenly my previous reliance on GUI-heavy word processors seems strangely unnecessary and over the top.

Another tool we simply couldn't do without is Trac. Once you get the hang of it it literally adds another project member to your team - it really is that powerful. So far we've only found one drawback, which is that the wiki uses a bespoke markup for formatting.

"What we want," thought Doug and I, "is a way to combine the power of Trac with the power of ReST, so that we can have our live documentation in the repository in sync with the wiki"

Obviously we aren't the only people to have had that thought. Like all the best ideas it combines two very powerful things and makes them all the more powerful. That and it's a piece of cake to use. Doc publishing for the lazy Trac user. Like the man says, "using it is adopting it." It really is that simple.

April 12, 2006

A Question of Context

For any non-trivial program you need to locate bits of data and code that aren’t . In a “normal” program it’s up to you to work out how to do this. Short programs generally use module level globals to find class definitions (i.e. import statements) and something homegrown for locating data - it might be a handle to a database, or some config file that specifies a directory containing some files or whatever. So far so obvious.

In a framework, however, it all gets far more complex. Your execution environment is expected to be much larger, and there may be many contributors of components. You may wish to switch components without editing code, ideally even at runtime.

Continue reading "A Question of Context" »