tab completion in python shell

June 25, 2008

recently I saw with this little piece of code to give the standard python shell tab completion capabilities:

# setup tab completion in python shell
import rlcompleter
import readline
readline.parse_and_bind("tab: complete")

obviously, you can use the environmental variable PYTHONSTART to execute this few lines anytime you start your python shell.

enjoy!

Advertisements

2 Responses to “tab completion in python shell”

  1. h4p0 Says:

    I noticed that with CTRL+tab I can get the same result as “double-tab” to get completion.
    Is there a way to have the normal Tabulator with TAB and the completion with CTRL+TAB?

  2. Mark Says:

    You could use ipython too which does this job for you and provides a hoddy of other stuff besides.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: