summaryrefslogtreecommitdiffstats
path: root/Lib/cmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/cmd.py')
-rw-r--r--Lib/cmd.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/Lib/cmd.py b/Lib/cmd.py
index 05ba7e3..859e910 100644
--- a/Lib/cmd.py
+++ b/Lib/cmd.py
@@ -40,12 +40,9 @@ The data members `self.doc_header', `self.misc_header', and
`self.undoc_header' set the headers used for the help function's
listings of documented functions, miscellaneous topics, and undocumented
functions respectively.
-
-These interpreters use raw_input; thus, if the readline module is loaded,
-they automatically support Emacs-like command history and editing features.
"""
-import string
+import string, sys
__all__ = ["Cmd"]
@@ -87,7 +84,6 @@ class Cmd:
sys.stdin and sys.stdout are used.
"""
- import sys
if stdin is not None:
self.stdin = stdin
else:
@@ -127,7 +123,7 @@ class Cmd:
else:
if self.use_rawinput:
try:
- line = raw_input(self.prompt)
+ line = input(self.prompt)
except EOFError:
line = 'EOF'
else:
@@ -336,7 +332,7 @@ class Cmd:
cmds_undoc.append(cmd)
self.stdout.write("%s\n"%str(self.doc_leader))
self.print_topics(self.doc_header, cmds_doc, 15,80)
- self.print_topics(self.misc_header, help.keys(),15,80)
+ self.print_topics(self.misc_header, list(help.keys()),15,80)
self.print_topics(self.undoc_header, cmds_undoc, 15,80)
def print_topics(self, header, cmds, cmdlen, maxcol):
@@ -356,11 +352,12 @@ class Cmd:
if not list:
self.stdout.write("<empty>\n")
return
+
nonstrings = [i for i in range(len(list))
if not isinstance(list[i], str)]
if nonstrings:
- raise TypeError, ("list[i] not a string for i in %s" %
- ", ".join(map(str, nonstrings)))
+ raise TypeError("list[i] not a string for i in %s"
+ % ", ".join(map(str, nonstrings)))
size = len(list)
if size == 1:
self.stdout.write('%s\n'%str(list[0]))