Example for readline module usage?

Peter Otten __peter__ at web.de
Mon Apr 6 18:46:16 CEST 2009


Grant Edwards wrote:

> On 2009-04-06, Peter Otten <__peter__ at web.de> wrote:
>> Grant Edwards wrote:
>>
>>> [I swear I've asked this question before, but Google can't find
>>> it.]
>>
>> My Google is better than yours then:
>>
>> http://mail.python.org/pipermail/python-list/2008-July/669582.html
> 
> It certainly is.  All I could come up with were tons of hits on
> the file-object's readline.  What I don't understand is
> how/where the readline module is told what file descriptor it's
> supposed to be reading from.  Is that just implicit in the
> "import" operation?

What I've gleaned from the source: On import it sets the
PyOS_ReadlineFunctionPointer in Parser/myreadline.c. If both stdin and
stdout are a tty (GNU) readline is invoked via this pointer.

Peter



More information about the Python-list mailing list