How do I get the currently installed tab completion function?
Steven D'Aprano
steve at pearwood.info
Mon Jun 22 21:02:19 EDT 2015
I have two (or more) different types of tab completion, and I want one to
apply under certain circumstances, and the other to apply at others. For
example, let's say I want one to apply inside a function which uses
raw_input (or input in Python 3), and the other to apply the rest of the
time.
So I might use this:
def getfilename():
prev = get_the_current_completer() # <<--- this
readline.set_completer(filename_completer)
try:
return raw_input("What file do you want? ")
finally:
readline.set_completer(prev)
Is that the best (only) way?
How do I get the currently installed completer?
Solutions for any version of Python acceptable, but if they work all the way
back to 2.4 or older, even better.
--
Steven
More information about the Python-list
mailing list