Python on the Mac - update

30 Oct 2007

A short while back I wrote about how to make Python more friendly on the Mac. Well, with Leopard things are a lot easier, as the Python interpreter comes with readline support. However, the tweak I suggested to enable tab completion no longer works, but it’s a minor change to set things right.

To enable tab completion in Leopard’s Python interpreter, create a file containing the following two lines of python:

> import readline, rlcompleter
> readline.parse\_and\_bind (“bind ^I rl\_complete”)

Having done that put the name of that file in the environmental variable PYTHONSTARTUP, which will cause Python to load the file when you start up the interpreter, and voila, everything should be okay.