@@ -19,10 +19,10 @@ module instead.
19
19
20
20
There are two parts to this job:
21
21
22
- #. Being able to tell if a line of input completes a Python statement: in
22
+ #. Being able to tell if a line of input completes a Python statement: in
23
23
short, telling whether to print '``>>> ``' or '``... ``' next.
24
24
25
- #. Remembering which future statements the user has entered, so subsequent
25
+ #. Remembering which future statements the user has entered, so subsequent
26
26
input can be compiled with these in effect.
27
27
28
28
The :mod: `codeop ` module provides a way of doing each of these things, and a way
@@ -33,19 +33,19 @@ To do just the former:
33
33
.. function :: compile_command(source, filename="<input>", symbol="single")
34
34
35
35
Tries to compile *source *, which should be a string of Python code and return a
36
- code object if *source * is valid Python code. In that case, the filename
36
+ code object if *source * is valid Python code. In that case, the filename
37
37
attribute of the code object will be *filename *, which defaults to
38
- ``'<input>' ``. Returns ``None `` if *source * is *not * valid Python code, but is a
38
+ ``'<input>' ``. Returns ``None `` if *source * is *not * valid Python code, but is a
39
39
prefix of valid Python code.
40
40
41
41
If there is a problem with *source *, an exception will be raised.
42
42
:exc: `SyntaxError ` is raised if there is invalid Python syntax, and
43
43
:exc: `OverflowError ` or :exc: `ValueError ` if there is an invalid literal.
44
44
45
45
The *symbol * argument determines whether *source * is compiled as a statement
46
- (``'single' ``, the default), as a sequence of statements (``'exec' ``) or
46
+ (``'single' ``, the default), as a sequence of :term: ` statement ` (``'exec' ``) or
47
47
as an :term: `expression ` (``'eval' ``). Any other value will
48
- cause :exc: `ValueError ` to be raised.
48
+ cause :exc: `ValueError ` to be raised.
49
49
50
50
.. note ::
51
51
@@ -69,5 +69,5 @@ To do just the former:
69
69
70
70
Instances of this class have :meth: `__call__ ` methods identical in signature to
71
71
:func: `compile_command `; the difference is that if the instance compiles program
72
- text containing a `` __future__ ` ` statement, the instance 'remembers' and
72
+ text containing a :mod: ` __future__ ` statement, the instance 'remembers' and
73
73
compiles all subsequent program texts with the statement in force.
0 commit comments