tab completion?

S

Siddhant

Hi people.
I was just wondering if a tab-completion feature in python command
line interface would be helpful?
If yes, then how can I implement it?
Thanks,
Siddhant
 
R

Ron DuPlain

Hi people.
I was just wondering if a tab-completion feature in python command
line interface would be helpful?
If yes, then how can I implement it?
Thanks,
Siddhant

ipython provides auto tab completion.
http://ipython.scipy.org/

You can also get it by:
$ easy_install ipython

Run it using the command:
$ ipython

Is this what you want?

Ron
 
S

sjdevnull

ipython provides auto tab completion.http://ipython.scipy.org/

You can also get it by:
$ easy_install ipython

Run it using the command:
$ ipython

Is this what you want?

ipython also makes stack traces nearly unreadable by default (setting
"xmode Plain" in the ipythonrc fixed that) and tends to take up too
much vertical screen space, wants to colorize a lot of stuff, and has
a few other things that I was't fond of. There's some nice stuff in
ipython (saving the return values of every line in the shell), but I
found trying to configure off all of the "magically helpful" stuff
that wound up being more annoying than useful was a fairly long job.

I found it easier just to turn on completion in the regular python
shell. From my .pythonrc:

try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
del readline, rlcompleter

With that and persistent history I'm pretty happy:

import readline
histfile = os.path.join(os.environ["HOME"], ".pyhist")
try:
readline.read_history_file(histfile)
except IOError:
pass
import atexit
atexit.register(readline.write_history_file, histfile)
del os, histfile
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top