Mittenchops
Mittenchops

Reputation: 19724

default tab completion like ipython in python console

I know I can use this:

import rlcompleter, readline
readline.parse_and_bind('tab: complete')

to enable ipython-style tab completion in my python interpreter.

How can I make this run by default on start, anytime I start python?

Upvotes: 1

Views: 176

Answers (1)

akira
akira

Reputation: 6147

Put that into a file .pythonrc (You can control the name of that file by the environment variable PYTHONSTARTUP). Read more about here:

PYTHONSTARTUP
If this is the name of a readable file, the Python commands 
in that file are executed before the first prompt is displayed
in interactive mode. The file is executed in the same namespace
where interactive commands are executed so that objects defined
or imported in it can be used without qualification in the interactive
session. You can also change the prompts sys.ps1 and sys.ps2 in this file.

see also:

Upvotes: 3

Related Questions