[IPython-dev] readline suckage

Fernando Perez Fernando.Perez at colorado.edu
Thu Jul 1 14:12:29 CDT 2004


Ville Vainio wrote:

> No, I figured the fix you implemented is good enough for now, and if the 
> readline really expects the completions given by "complete()" to 
> actually begin with the "text" argument (as the docs state), there is 
> very little we can do about it for now. Perhaps the fix should be 
> focused on the python implementation of readline, which is needed on 
> windows anyway (and windows tend to suffer from space-ridden filenames 
> more than *n*x anyway...).

Ok, so it stays for now.  People shouldn't use spaces in their filenames 
anyway, we might as well ipython as an educational tool :)

> However, gnu readline does support spaces in filenames (as evidenced by 
> bash & friends). So perhaps the fix should be made to the python 
> readline wrapper?

I think that the problem is that readline.py only wraps part of the full gnu 
readline.  If you look at the GNU readline docs:

http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html

you'll see that it's huge.  Python's readline module doesn't really expose too 
much:

planck[~/test]|6> import readline
planck[~/test]|7> readline.
readline.add_history                 readline.parse_and_bind
readline.get_begidx                  readline.read_history_file
readline.get_completer               readline.read_init_file
readline.get_completer_delims        readline.redisplay
readline.get_current_history_length  readline.set_completer
readline.get_endidx                  readline.set_completer_delims
readline.get_history_item            readline.set_history_length
readline.get_history_length          readline.set_pre_input_hook
readline.get_line_buffer             readline.set_startup_hook
readline.insert_text                 readline.write_history_file

Enough for many purposes, but definitely not the whole monster.

The reason is probably the normal historical one: they wrapped as much as was 
needed for the more common usage cases, and it stopped there.  I'm sure one 
could dig into the C wrapper and finish up the job.  However, I will most 
definitely NOT spend my time on that, given that the cost/benefit ratio feels 
to me very much divergent.

Best,

f




More information about the IPython-dev mailing list