[IPython-user] [Fwd: History event recall & file name completion]

Fernando Perez fperez at colorado.edu
Wed Dec 17 10:18:47 CST 2003

I'm forwarding here a user question.

Andrew, please note that non-subscriber postings are disabled to the ipython 
lists, due to the ridiculous amount of spam we were getting.  I got your 
message forwarded to me by the mailman auto-discarder.  Sorry for this, but 
the spam problem was getting out of hand.

-------- Original Message --------
Subject: History event recall & file name completion
From: Andrew Malcolmson <andzy at imap-mail.com>
Date: Wed, 17 Dec 2003 00:12:20 -0500
To: ipython-user at scipy.net

Hi Ipythonistas!

2 questions:

1. Can I recall an history event by line number in IPython like you can in
the shell with !<line #> ?  If there's a choice, I'd prefer a recall that
works like zsh's HIST_VERIFY option which lets you edit the line before
executing it.

2. I'm not getting file or directory completion.  I know this should work
but pressing the TAB key doesn't return any completions. Changing
the command from 'ls' to '@ls' to '!ls' doesn't make any difference.

I'm using IPython 5.0 over zsh on Debian unstable.

----------------My reply:

1. All the history is held in by line number in the In[] array, so you can type:

In [1]: print 'hi'

In [2]: exec In[1]

But there's no editing other than by normal python means:

In [3]: exec In[1].replace('hi','hello')

If anyone knows of a reasonably simple way of implementing Andrew's request, 
I'm all ears.

2. You are probably using python 2.3.  Python changed its readline behavior at 
the C level in 2.3 and they broke filename and directory completion.   Thanks 
to Jeff Collins, ipython's current cvs code already implements a workaround, 
but this hasn't been released yet (it's available to you if you want to use 
the CVS code).  We'll have an official new release out in the next few weeks.



More information about the IPython-user mailing list