Instantiate a line-oriented interpreter framework. The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The
(self, completekey='tab', stdin=None, stdout=None)
| 77 | use_rawinput = 1 |
| 78 | |
| 79 | def __init__(self, completekey='tab', stdin=None, stdout=None): |
| 80 | """Instantiate a line-oriented interpreter framework. |
| 81 | |
| 82 | The optional argument 'completekey' is the readline name of a |
| 83 | completion key; it defaults to the Tab key. If completekey is |
| 84 | not None and the readline module is available, command completion |
| 85 | is done automatically. The optional arguments stdin and stdout |
| 86 | specify alternate input and output file objects; if not specified, |
| 87 | sys.stdin and sys.stdout are used. |
| 88 | |
| 89 | """ |
| 90 | if stdin is not None: |
| 91 | self.stdin = stdin |
| 92 | else: |
| 93 | self.stdin = sys.stdin |
| 94 | if stdout is not None: |
| 95 | self.stdout = stdout |
| 96 | else: |
| 97 | self.stdout = sys.stdout |
| 98 | self.cmdqueue = [] |
| 99 | self.completekey = completekey |
| 100 | |
| 101 | def cmdloop(self, intro=None): |
| 102 | """Repeatedly issue a prompt, accept input, parse an initial prefix |