[New-bugs-announce] [issue13946] readline completer could return an iterable

Nicolas report at bugs.python.org
Sun Feb 5 20:48:01 CET 2012


New submission from Nicolas <nicolas-gaudin at laposte.net>:

The function set by readline.set_completer must return one completion per call.  This should be great if we can return an iterable, because with current implementation I have to write a wrapper:

cache = None
def completer(text, state):
  if cache:
    if len(cache) > 0:
      return cache.pop(0)
    else:
      cache = None
      return None
  res = completer_returning_iterable(text)
  if isinstance(res, str) or res == None:
    return res
  cache = res
  return completer(text, state)
readline.set_completer(completer)

And completer_returning_list, the true completer, returns a pythonic iterable for all possible completion.

----------
components: Library (Lib)
messages: 152703
nosy: nicolas_49
priority: normal
severity: normal
status: open
title: readline completer could return an iterable
type: enhancement
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13946>
_______________________________________


More information about the New-bugs-announce mailing list