[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

tab completion?

Siddhant

3/4/2008 3:13:00 PM

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
4 Answers

james.pye

3/4/2008 3:19:00 PM

0

On Mar 4, 8:13 am, Siddhant <siddhantg...@gmail.com> wrote:
> 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

Is this what you are looking for?

http://docs.python.org/lib/module-rlcomp...

Ron DuPlain

3/4/2008 3:44:00 PM

0

On Mar 4, 10:13 am, Siddhant <siddhantg...@gmail.com> wrote:
> 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....

You can also get it by:
$ easy_install ipython

Run it using the command:
$ ipython

Is this what you want?

Ron


--
Ron DuPlain <ron.duplain@gmail.com>
http://www.linkedin.com/i...

sjdevnull@yahoo.com

3/4/2008 4:19:00 PM

0

On Mar 4, 10:44 am, Ron DuPlain <ron.dupl...@gmail.com> wrote:
> On Mar 4, 10:13 am, Siddhant <siddhantg...@gmail.com> wrote:
>
> > 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....
>
> 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

Siddhant

3/4/2008 5:27:00 PM

0

Yes. Almost what I wanted. Thanks. :)