diff options
author | Georg Brandl <georg@python.org> | 2009-04-05 22:20:44 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-05 22:20:44 (GMT) |
commit | 0d8f07305d7ddcf684c3db5680263c98cf70c067 (patch) | |
tree | 8862b638d9b3e98ce030044765e9231333821f94 /Doc/library/code.rst | |
parent | 889b0aa4506d5ea43985865a44562ebd39b3bf00 (diff) | |
download | cpython-0d8f07305d7ddcf684c3db5680263c98cf70c067.zip cpython-0d8f07305d7ddcf684c3db5680263c98cf70c067.tar.gz cpython-0d8f07305d7ddcf684c3db5680263c98cf70c067.tar.bz2 |
Update signature style of optional arguments, part two.
Diffstat (limited to 'Doc/library/code.rst')
-rw-r--r-- | Doc/library/code.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/library/code.rst b/Doc/library/code.rst index 4e00639..4219e9e 100644 --- a/Doc/library/code.rst +++ b/Doc/library/code.rst @@ -12,7 +12,7 @@ Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt. -.. class:: InteractiveInterpreter([locals]) +.. class:: InteractiveInterpreter(locals=None) This class deals with parsing and interpreter state (the user's namespace); it does not deal with input buffering or prompting or input file naming (the @@ -22,14 +22,14 @@ build applications which provide an interactive interpreter prompt. ``'__doc__'`` set to ``None``. -.. class:: InteractiveConsole([locals[, filename]]) +.. class:: InteractiveConsole(locals=None, filename="<console>") Closely emulate the behavior of the interactive Python interpreter. This class builds on :class:`InteractiveInterpreter` and adds prompting using the familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. -.. function:: interact([banner[, readfunc[, local]]]) +.. function:: interact(banner=None, readfunc=None, local=None) Convenience function to run a read-eval-print loop. This creates a new instance of :class:`InteractiveConsole` and sets *readfunc* to be used as the @@ -40,7 +40,7 @@ build applications which provide an interactive interpreter prompt. discarded after use. -.. function:: compile_command(source[, filename[, symbol]]) +.. function:: compile_command(source, filename="<input>", symbol="single") This function is useful for programs that want to emulate Python's interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is to determine @@ -67,7 +67,7 @@ Interactive Interpreter Objects ------------------------------- -.. method:: InteractiveInterpreter.runsource(source[, filename[, symbol]]) +.. method:: InteractiveInterpreter.runsource(source, filename="<input>", symbol="single") Compile and run some source in the interpreter. Arguments are the same as for :func:`compile_command`; the default for *filename* is ``'<input>'``, and for @@ -100,7 +100,7 @@ Interactive Interpreter Objects with it. -.. method:: InteractiveInterpreter.showsyntaxerror([filename]) +.. method:: InteractiveInterpreter.showsyntaxerror(filename=None) Display the syntax error that just occurred. This does not display a stack trace because there isn't one for syntax errors. If *filename* is given, it is @@ -132,7 +132,7 @@ The :class:`InteractiveConsole` class is a subclass of interpreter objects as well as the following additions. -.. method:: InteractiveConsole.interact([banner]) +.. method:: InteractiveConsole.interact(banner=None) Closely emulate the interactive Python console. The optional banner argument specify the banner to print before the first interaction; by default it prints a @@ -158,7 +158,7 @@ interpreter objects as well as the following additions. Remove any unhandled source text from the input buffer. -.. method:: InteractiveConsole.raw_input([prompt]) +.. method:: InteractiveConsole.raw_input(prompt="") Write a prompt and read a line. The returned line does not include the trailing newline. When the user enters the EOF key sequence, :exc:`EOFError` is raised. |