[issue13946] readline completer could return an iterable

2019-03-15 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13946] readline completer could return an iterable

2014-07-03 Thread Mark Lawrence

Mark Lawrence added the comment:

Is this a good, bad or indifferent idea?

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13946
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13946] readline completer could return an iterable

2014-07-03 Thread Josh Rosenberg

Josh Rosenberg added the comment:

I agree the design requiring it to pass the same information over and over is a 
bit odd (I've occasionally had cause to borrow some of ipython's niftyness 
for a plain Python terminal, and making custom completers work is one of the 
more awkward parts of the whole process). I'm guessing this is a product of 
conforming overzealously to the C API for readline functions like 
rl_filename_completion_function (see: 
http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC47 ).

It doesn't seem possible to do this nicely; __next__() on a generic iterator 
won't accept arguments (and practically, one of these arguments is state, the 
other is just get next), and trying to catch a TypeError due to the wrong 
number of arguments or using a generator as a string so you switch modes is 
ugly. Either the existing interface spawns additional arguments (also ugly; 
boolean flags that completely change behavior are the last refuge of a 
scoundrel), or a new function is created (possibly deprecating the old one over 
time.

Any suggestions?

--
nosy: +josh.rosenberg

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13946
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13946] readline completer could return an iterable

2012-02-11 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
versions: +Python 3.3 -Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13946
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13946] readline completer could return an iterable

2012-02-05 Thread Nicolas

New submission from Nicolas nicolas-gau...@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 rep...@bugs.python.org
http://bugs.python.org/issue13946
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com