【发布时间】:2015-09-22 15:31:59
【问题描述】:
无论我做什么,GNU/readline 似乎都会对我的数据进行排序。我的代码看起来就像文档中的一样:
tags = [tag.lower() for tag in tags]
def completer(text, state):
text = text.lower()
options = [tag for tag in tags if tag.startswith(text)]
try:
return options[state]
except IndexError:
return None
readline.set_completer(completer)
readline.parse_and_bind('tab: menu-complete')
如果我的标签是['jarre', 'abba', 'beatles'],我会不断收到['abba', 'beatles', 'jarre']。如何强制保留我的订单?
【问题讨论】:
标签: python readline libreadline