Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Readline configuration

Reply
Thread Tools

Readline configuration

 
 
Mark Roach
Guest
Posts: n/a
 
      01-01-2005
I have readline set up pretty much the same way as in the example in the
python docs (http://docs.python.org/lib/readline-example.html) and
something I find myself doing fairly often is

type some code
more code
more code
...

and then wanting to scroll back through the history to run the same code
again after a module = reload(module). In Windows, this is pretty
convenient as I can use up to move to point x in the history, press enter,
and press down to move to point x+1 in history. Is there any way to get
the same behavior with readline?

It would be great to be able to ctrl+r <type part of first line> then just
hit down+enter to reenter the rest of the code.

Thanks,

Mark
 
Reply With Quote
 
 
 
 
Fernando Perez
Guest
Posts: n/a
 
      01-05-2005
Mark Roach wrote:

> I have readline set up pretty much the same way as in the example in the
> python docs (http://docs.python.org/lib/readline-example.html) and
> something I find myself doing fairly often is
>
> type some code
> more code
> more code
> ...
>
> and then wanting to scroll back through the history to run the same code
> again after a module = reload(module). In Windows, this is pretty
> convenient as I can use up to move to point x in the history, press enter,
> and press down to move to point x+1 in history. Is there any way to get
> the same behavior with readline?
>
> It would be great to be able to ctrl+r <type part of first line> then just
> hit down+enter to reenter the rest of the code.


See ipython (http://ipython.scipy.org). It provides mostly what you want:

In [1]: for i in range(3):
...: print i,
...:
0 1 2

In [2]: print 'hello'
hello

In [3]: exec In[1]
0 1 2

Readline history search is bound to Ctrl-P/N (type a few characters, then hit
Ctrl-P/N to get previous/next lines with those matching chars). Ctrl-r search
is also configured by default.

HTH,

f

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling python 3.1.2 with local readline fails to get readline - help! gavino Python 4 09-20-2010 05:17 AM
Getting application ReadLine and Perl debugger ReadLine to cooperate Andrew DeFaria Perl Misc 1 01-30-2008 11:46 PM
Readline::readline() blocking all other threads Jean-Michel Ruby 0 12-22-2007 01:00 AM
Configuration reverted to previous configuration after power loss ward@sciinc.com Cisco 0 03-03-2006 04:14 PM
PEAP Configuration Woes - PEAP configuration help jester Cisco 1 12-20-2005 02:04 PM



Advertisments