[on topic] Re: readline trick needed

Ned Deily nad at acm.org
Tue Oct 16 16:44:45 EDT 2012


In article <k5jcbs$eub$1 at ger.gmane.org>, Peter Otten <__peter__ at web.de> 
wrote:
> Ned Deily wrote:
> > Keep in mind that the Python readline module may be linked to either the
> > GPL-licensed GNU readline or the BSD-licensed editline (libedit) library
> > (the default on newer OS X systems and probably on *BSD systems) and
> > they have different command strings.  Note the warning here:
> > 
> > http://docs.python.org/py3k/library/readline.html
> 
> I think you are a Mac user. If so, can the snippet I posted be generalised 
> to work with libedit?

Isn't it hairy enough??

Here's how to make tab complete work with both; it gives an idea of the 
libedit commands:

     import rlcompleter
     if 'libedit' in readline.__doc__:
         readline.parse_and_bind("bind ^I rl_complete")
     else:  # GNU readline format
         readline.parse_and_bind("tab: complete")

The documentation of the command syntax is in the .editrc man pages, for 
example:

https://developer.apple.com/library/mac/#documentation/Darwin/Reference/M
anPages/man5/editrc.5.html
 
> > Or it may not be linked with either. 
> OK, change "no warranties" to "absolutely no warranties" ;)

Good idea.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list