GNU readline is a library that provides command-line editing facilities, such being able to browse through history with the cursor up/down keys - most Linux users would have seen this at the bash command line. It's also possible to include these features in your own Python programs, using Python's readline module.
This article from O'Reilly explains how to do this, and gives a few good examples.