Readline/command history w/ interactive prompt
Mark Jackson
mjackson at wrc.xerox.com
Wed Apr 17 13:51:17 EDT 2002
Andy Gimblett <gimbo at ftech.net> writes:
> 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...
Try hitting control-r and typing a short string that last appeared in
the line desired ("my" or even "m" would work in this case).
--
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
The greatest masterpiece in literature is only a dictionary
out of order. - Jean Cocteau
More information about the Python-list
mailing list