Confusion regarding the readline module

Discussion in 'Python' started by Siddhant, May 6, 2008.

  1. Siddhant

    Siddhant Guest

    Hi!
    I am having some doubts related to the readline module. I hope someone
    could clear them.
    1. What exactly does the readline.get_line_buffer() function do? Does
    it return whatever is the current input by the user? If yes, then can
    I use it to check the current inputs of the user and base the next-
    word completion against whatever the user has entered so far? There
    wasn't much documentation on it, and a lot of googling couldn't help
    much. :(
    2. Related to the completer function, what is meant by returning the
    "state"th completion for "text"? Is the completer function called
    everytime (for all possible values of "state") when I press the Tab
    key? When/How is it called?

    Basically, I need to define a completer function, that should take
    into consideration whatever the user has entered so far, and complete
    the next word accordingly. The same way as a "cd /some/file" is
    meaningless.
     
    Siddhant, May 6, 2008
    #1
    1. Advertising

  2. Siddhant wrote:

    > Hi!
    > I am having some doubts related to the readline module. I hope someone
    > could clear them.
    > 1. What exactly does the readline.get_line_buffer() function do? Does
    > it return whatever is the current input by the user? If yes, then can
    > I use it to check the current inputs of the user and base the next-
    > word completion against whatever the user has entered so far? There
    > wasn't much documentation on it, and a lot of googling couldn't help
    > much. :(
    > 2. Related to the completer function, what is meant by returning the
    > "state"th completion for "text"? Is the completer function called
    > everytime (for all possible values of "state") when I press the Tab
    > key? When/How is it called?
    >
    > Basically, I need to define a completer function, that should take
    > into consideration whatever the user has entered so far, and complete
    > the next word accordingly. The same way as a "cd /some/file" is
    > meaningless.


    I don't know anything about readline (beyond it's existence of course) - but
    I do know & use the rlcompleter2 module. Go download it and look into it's
    source, it should give you an idea how to proceed.

    Diez
     
    Diez B. Roggisch, May 6, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vivek

    confusion regarding aspnet_wp.exe

    Vivek, Jun 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    308
    Teemu Keiski
    Jun 28, 2004
  2. gg
    Replies:
    8
    Views:
    340
  3. gavino
    Replies:
    4
    Views:
    540
    gavino
    Sep 20, 2010
  4. Jean-Michel
    Replies:
    0
    Views:
    361
    Jean-Michel
    Dec 22, 2007
  5. Andrew DeFaria
    Replies:
    1
    Views:
    211
    Ben Morrow
    Jan 30, 2008
Loading...

Share This Page