[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)
Kimball Leavitt
report at bugs.python.org
Fri Sep 27 11:48:43 EDT 2019
Kimball Leavitt <kimballleavitt at gmail.com> added the comment:
I know that many people do something like:
def do_EOF(self, arg):
return True
to exit the program when you press Ctrl+d. Others might prefer something like ngie https://bugs.python.org/issue13214#msg145856:
def do_EOF(self, arg):
raise EOFError
The issue that I have is if the command you enter is 'EOF' (or 'EOF --some --arg'), you end up calling your do_EOF function. I think this unintended side effect could be avoided if the check for EOFError was removed and the exception was just raised. (see https://github.com/python/cpython/blob/master/Lib/cmd.py#L127).
----------
nosy: +Kimball Leavitt
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue13214>
_______________________________________
More information about the Python-bugs-list
mailing list