Readline/command history w/ interactive prompt

Andy Gimblett gimbo at ftech.net
Wed Apr 17 12:38:18 EDT 2002


Just a thought...

One of the things I find "warty" about the interactive prompt is that
the command-line history retains multiple copies of identical
successive lines, rather than trimming them down to a single instance.

Slightly fictional example:

>>> import my_mysql_wrapper
>>> d = my_mysql_wrapper.connection(parms)
>>> d.select('select count(*) from some_table')
>>> reload(my_mysql_wrapper)
<module 'my_mysql_wrapper' from 'my_mysql_wrapper.py'>
>>> d.select('select count(*) from some_table')
>>> d.select('select count(*) from some_table')
>>> d.select('select count(*) from some_table')
>>> d.select('select count(*) from some_table')
>>> d.select('select count(*) from some_table')
... another 15 instances of that same .select() call

At this point, I go and fix a bug in my_mysql_wrapper, so I want to
reload it.  Alas, I have to hit the up arrow 20 times to make that
happen, and I have to watch carefully to see when I get the line I
want.  If only it could be done with a mere 2 hits instead...

Now, I'm thinking this is _probably_ a limitation of GNU readline, not
python per se, because I notice this behaviour in bash too.  Can
anyone tell me if this is the case or not?  And is there any good
reason for having this behaviour?  It seems well crufty to me - the
Amiga shell did this right, why can't GNU/we?  ;-)

Hmmm... /me wonders if python on the Amiga gets this right...  :-)

As I said, just a thought...

Cheers,

Andy

-- 
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.





More information about the Python-list mailing list