Categories
Blather Programming Software

Text editors

I was browsing my list of free programmers’ editors and discovered some broken links. It seems a couple of editors have gone the way of all bits. Farewell, ManyaPad! Goodbye, lpe! We shall mourn your loss and taste your power no more.

In the plus column, I found a living editor: Gobby, a free real-time collaborative editor with support for programming lanuage syntax highlighting.

Categories
Programming Python Software

Three cheers for the Python subprocess module

Up until recently, if I needed to launch a child process from a Python program, I would use the system() function in the os module, because it was the easiest one for me to remember how to use. This is despite the fact that system() is rarely what I actually wanted.

For starters, os.system() runs the command in a shell, so unless you are actually using the shell redirection operators or argument expansion, the function is just launching a shell in order to run the program you really wanted to start in the first place. Second, the shell is going to interpret your arguments the way shells do — splitting arguments on spaces, expanding wildcards, etc. If one of the arguments is a filename with spaces and shell special characters, you have to escape it very carefully (and in a system-specific way) to prevent the shell from messing with it. Naturally, I often just wouldn’t bother and thus my commands would fail whenever a strange filename showed up.

Before the introduction of the subprocess module in python 2.4, the alternatives were either the popen-style calls, or the spawn* family of functions, or possibly the ‘commands’ module. There are two implementations of the popen calls, one in the os module and one in the popen2 module, with different calling conventions. The spawn functions are simple wrappers around the C library calls of the same name, and thus feel very different from a typical python function. None of the alternatives are particularly easy to remember, a problem compounded by the sheer number of them and their different calling conventions.

The subprocess module has pretty much supplanted all of them with a straightforward and very pythonic interface. It’s easy to remember, the defaults are what you would expect, and all the arguments and methods have intuitive names. To everyone who contributed to it: well done.

Categories
Blather Books Programming Python Software

Books

Okee dokey, I just finished my Python script to turn my book database into wordpress blog entries.  Instant wordpress blog history, it’s like I’ve been blogging for years! Back when it wasn’t cool.

Categories
Books Erlang Programming Software

Book: Programming Erlang

An excellent introduction to the intriguing programming language and distributed software framework Erlang.

Categories
Books Programming Python

Book: Foundations of Python Network Programming

A serviceable guide to network programming in Python.

Categories
Books Programming Python

Book: Python Standard Library

From the title, I expected this to be a thorough reference to the standard Python modules, but instead it is a collection of sample scripts which illustrate the basic usage of the standard modules. In that respect it is similar to the Python Cookbook, but the Cookbook has better recipes and more in-depth discussions of the recipes. Also, this book only covers up to Python 2.0 and is thus somewhat out of date. For example, it covers the obsolete ‘rfc822′ module, but not the new ’email’ module. Also, this book has at least one glaring error — it claims that XML is an application of SGML, which is simply not true. XML is a full-blown meta-markup language like SGML.

Recommendation: skip this and get the Python Cookbook instead.

Categories
Books Programming Python

Book: Python Cookbook

This Python programming cookbook lives up to the standard set by the excellent Perl Cookbook. In addition, this book is associated with a website where the programming recipes were originally collected from Python users. The website continues to grow and collect new recipes and thus represents a great resource for Python programmers.

Categories
Books Programming Python

Book: Python Essential Reference

A good reference to the fast-changing programming language Python. My one complaint is that the type is too small.

Categories
Books Programming Python

Book: Programming Python

This is a fairly good introduction to the Python programming language. Its organization, however, makes it hard to use when you just want to refresh your memory about a particular detail you have forgotten.

Categories
Books Programming Python

Book: The Zope Book

This is a nice introduction to the Zope web publishing system, the system used to create this website. The currently published edition is a bit out of date, however, so you might try the the online version.

Zope is a python-based object system with a web-based interface. It’s a lot of fun to work in, though I’m only beginning to scratch the surface of all its features.