Python interpreter tab completion on OS X

This is mainly for me own reference, but it is probably something that other people will find useful. If you attempt to use the rl­com­pleter module on the Mac you'll find that tab completion does not work correctly. Apparently this is because Apple ship a neutered version of readline.

To get completion working you have to use a different argument to readline.parse_and_bind(). The base example uses:

readline.parse_and_bind("tab: complete")

Change that line to:

readline.parse_and_bind ("bind ^I rl_complete")

Tagged with mac, osx and python.