[Patches] [Patch #102891] Alternative readline module
Guido van Rossum
guido@python.org
Tue, 16 Jan 2001 18:35:20 -0500
> On Tue, Jan 16, 2001 at 03:37:44PM -0500, Guido van Rossum wrote:
> > A hook exists: you can assign a readline-ish function to
> > PyOS_ReadlineFunctionPointer.
>
> You can't do that from within Python code though, can you?
No, but you could easily write a little extension that sets it to a C
function that can call an arbitrary Python code. (Just realize that
it's called without the Python global interpreter lock held.)
> Although pyrl is not nearly ready for the prime time, I think the
> general approach is a good one long term. Command line editing
> is not a performance critical task. Python code is fast enough.
> Moving this task to Python should allow the editor to be made
> cross platform more easily.
Sadly, this isn't the case -- pyrl uses curses and/or termios calls
that are highly Unix specific. :-)
> Also, it should be easier to add
> more advanced features. I would like the editor to work like the
> Z shell editor in that you can edit whole blocks. For example,
> if I enter:
>
> for i in range(10):
> print i
>
> and press up arrow I would be able to edit the whole for loop as
> a block.
Just use IDLE -- it has all that. Character cell interfaces aren't
worth the effort of keeping up.
--Guido van Rossum (home page: http://www.python.org/~guido/)