Python Programming, news on the Voidspace Python Projects and all things techie.

User Plugin for rest2web

emoticon:html The first user plugin has been written for rest2web.

That's not bad considering I've not settled the API. Smile

It's actually an interesting plugin, by a chap called Paul Bartlett. He's created a Source Code Highlighting Plugin, it works for multiple languages (unlike the standard macro one) by using an external php script. It also adds a link to the code to download. Nice.

rest2web is slowly finding more users. I mainly develop it for Voidspace, but it's nice to see it being useful for other people.

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-11-25 13:30:00 | |

Categories: ,

Yahoo Maps and Python

emoticon:python this is probably old news - but I've never heard it. I stumbled across Yahoo Maps today (ironically enough via Google). The URL is :

Notice the prominence of py in the URL. Smile Looks like yahoo are using Python for (at least part of) their mapping software. Nice !

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-11-25 12:36:00 | |


Best of the Blog

emoticon:noise I've just added a new page - Best of the Blog.

It contains links to the better (or longer) posts that I've made on this blog. As you might imagine, it's quite short ! Wink

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-11-25 12:07:09 | |


Ordered Dictionary

emoticon:drive The odict module is one of the most popular in the pythonutils collection.

There has been extensive discussion on the subject at comp.lang.python. It seems like a lot of people want an Ordered Dictionary, or have opinions about what it ought to do.

As a result of this discussion, Nicola and I are going to make changes and improvements to the odict module.

These include :

  • Adding sequence methods like :

    • insert
    • sort
    • reverse
  • Allowing slicing

  • Performance improvements on creating an instance

  • Hiding the sequence attribute and providing access to it through the keys and values methods. (Including allowing you to set them, by passing a sequence to these methods)

  • Possible alternative implementations (probably simple sub-classes), for use-cases other than "key ordering by insertion time"

This last change will break backwards compatibility. Any objections should be raised now, before it's too late. Smile

At some point I will have to decide whether to make (all of) the same changes to ConfigObj, which is also (effectively) an ordered dictionary.

It's worth pointing out (as illustrated by Fredrik Lundh) that an ordered dictionary is mainly a convenience object. (Although damn convenient). You can usually get better performance on the same data structure by using a list of tuples, and passing it to dict when you want to access members by key. The resulting code is less readable though, IMHO.

That could be resolved by an implementation in C, or by waiting for PyPy, upon which pure Python implementations are secretly hoped to run faster than C. Wink

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-11-24 10:49:02 | |

Categories: ,

Click Thru for Me

emoticon:dollars I use two good services that have affiliate programs. I haven't earned anything from either (yet) - but they're both good services, so worth referring people to.

The first is my virtual host provider. They're called Tektonic and offer cheap virtual hosting accounts (with root access). This is a great way of playing with a dedicated server, without the expense.

Tektonic - the Power of Root

I've had no noticeable downtime with these guys, and their tech support is very good. If you're prepared to install your own server - or have someone else do it for you Wink - it's an easy way to get a hosting account that allows you to play around with all the fancy new web frameworks we're seeing.

The second is cheap usenet access from Teranews.

The free service (which I use) actually costs $4 to open the account and gives you 50mb of nntp access per day. Access is very fast, and they carry all the binary groups. They have a range of other packages as well.

If either of these services appeal to you, you might as well go through my affiliate links. Smile

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-11-24 09:04:40 | |


Reply-To Considered *Damn* Useful

emoticon:music It annoys me that most Sourceforge mailing lists (and some other lists that use mailman) don't set Reply-To back to the list.

This is (I guess) a long running debate. This is my reply to the summary points in Reply-To Considered Harmful.

  • It violates the principle of minimal munging.

    Practicality beats purity. Wink [1]

  • It provides no benefit to the user of a reasonable mailer.

    This isn't true. I use Thunderbird, and unless I'm missing an obvious option somewhere, I always have to choose between manually copy and pasting the list address, or using Reply-All and deleting the original sender (to only reply to the list).

    It looks like he is defining any reasonable mailer as Elm. Confused

  • It limits a subscriber's freedom to choose how he or she will direct a response.

    Not true - all reasonable mailers preserve the original from address as part of the email.

    All reasonable list managers do too. Why should most of us (the most of us who don't use the one true mailer) suffer because of the occasional, badly designed list manager.

  • It actually reduces functionality for the user of a reasonable mailer.

    Not true. The original from address is still preserved - as above. (So there need be no reduction in functionality).

  • It removes important information, which can make it impossible to get back to the message sender.


  • It penalizes the person with a reasonable mailer in order to coddle those running brain-dead software.

    His base premise is that in a reasonable mailer, munging reply-to risks losing the original From information.

    This means that because you have the option to hit Reply-All if you want to reply to the list as well, it's better not to mung.

    This assumes you're happy to send two copies to the original sender (one from the list as well). I've also never seen a reasonable mailer which loses the information in question.

    90% (or more) of the time I want to reply 'On-List'.

    If his reasonable mailer really does make it harder to reply to the sender, with emails munged in this way, maybe his mailer is at fault. Razz

  • It violates the principle of least work because complicates the procedure for replying to messages.

    See above - the principle of least work damages his argument.

  • It violates the principle of least surprise because it changes the way a mailer works.

    Nonsense. The message is from the list, so least surprise is to reply to the list.

  • It violates the principle of least damage, and it encourages a failure mode that can be extremely embarrassing -- or worse.

    Unless there are negative consequences of not replying to the list. (Email doesn't reach a large proportion of intended and expected recipients).

    The normal way to reply to an email is to use the Reply button. Not using the Reply-To feature breaks the standard behaviour - which is annoying and awkward, and more likely to result in failure.

  • Your subscribers don't want you to do it. Or, at least the ones who have bothered to read the docs for their mailer don't want you to do it.

    Moot point. Breaking the expected behaviour of the standard email client, makes it annoying to use lists configured in this way. I think subscribers do want it... Except pretentious ones who use Elm. Very Happy [2]

Anyway, rant over.

[1]This is the most valid point he makes, actually.
[2]I have nothing against Elm users, except the pretentious ones...

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-11-21 12:37:20 | |


Website Updates with rest2web

emoticon:cyberpunk I've just updated more of my website to the new style. I've started on the Cyberpunk and William Gibson pages to accompany Cyberpunk Search.

The updates are made much easier by rest2web. For those who are interested in a site building tool, but still don't understand what rest2web has to offer, here's a brief example.

A website is divided into directories, each directory has an index page and several individual pages - all of which are stored as text files.

The individual pages (articles) can be stored in reST format, which is much easier to maintain (although you can also use HTML if you want - I could support alternative markup formats if anyone wanted them). The generated pages are all inserted into an HTML template.

Each page starts with a small piece of metadata that describes the page. A typical one might be :

    target: ../gibson_disney.shtml
    crumb: Disney
    tags: cyberpunk, gibson, article, disney, singapore, travel
    section: articles
         An unusual article by William Gibson...
         on a visit to Singapore.

Most of these are optional. Razz

The article in each directory can be divided into several sections. This makes the index page clearer.

The nice thing is, that the metadata for the pages in a directory are in the pages themselves. The index page is passed all the metadata when it is created.

You can build most of the index page with something like the following snippet of code :

for sec_name, section in sections.items():
    print '<div class="indexblock">'
    title = '''
% (section['title'], section['description'])
    print_details(section, split=False, page_title=title)
    print '</div>'

It's easier to show you the results than to explain the details. Have a look at the Cyberpunk Index Page.

rest2web uses the metadata - plus a title and description of each section in the index page metadata - to build the index page. You can also specify the order that pages appear in each section. Nice hey. Very Happy

Like this post? Digg it or it.

Posted by Fuzzyman on 2005-11-21 09:44:14 | |

Categories: ,

Hosted by Webfaction