Wednesday, December 11, 2002

Cool Python Hack

While looking for some random bit o' python wisdom, I ran across pyrepl. Pyrepl provides a command line interpreter environment that includes all of the automatic completion features of the solution I mentioned a few days ago, but in realtime.

That is, if you hit <tab><tab>, pyrepl shows all of the completions. As you type more, the list of completions changes to reflect your typing. Finally, when you hit return to accept whatever was completed (or whatever you typed), pyrepl emits the VT100 codes necessary to eliminate all evidence that pyrepl was used to complete the command (thus, making pyrepl compatible with doctest).

In and of itself, that is very cool. But that isn't all.

pyrepl also includes the ability to edit multiline expressions (say, a block headed by a def..., class... or for... statement) interactively. Unlike the typical command line interpreter, pyrepl's history of commands is truly the history of complete expressions entered into the interpreter and not the history of lines entered, regardless of scope.

Pyrepl mailing lists are also available.
3:27:36 PM