Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libcode.tex @ 8918:acfffe14628e legacy-trunk
New section header style.
Fix up a few synopses.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Mon, 10 Aug 1998 19:42:37 +0000 |
| parents | 760dcf197048 |
| children | 0d2791c7206d |
| rev | line source |
|---|---|
| 8918 | 1 \section{\module{code} --- |
| 2 Code object services.} | |
|
8716
760dcf197048
Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents:
7877
diff
changeset
|
3 \declaremodule{standard}{code} |
|
760dcf197048
Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents:
7877
diff
changeset
|
4 |
|
760dcf197048
Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents:
7877
diff
changeset
|
5 \modulesynopsis{Code object services.} |
|
760dcf197048
Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents:
7877
diff
changeset
|
6 |
|
5842
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 The \code{code} module defines operations pertaining to Python code |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 objects. |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 The \code{code} module defines the following functions: |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 |
|
6960
319a51c381ce
Nit adjustments to remove warnings when processed with partparse.py.
Fred Drake <fdrake@acm.org>
parents:
6896
diff
changeset
|
14 \begin{funcdesc}{compile_command}{source, \optional{filename\optional{, symbol}}} |
|
5842
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 This function is useful for programs that want to emulate Python's |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 interpreter main loop (a.k.a. the read-eval-print loop). The tricky |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 part is to determine when the user has entered an incomplete command |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 that can be completed by entering more text (as opposed to a complete |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 command or a syntax error). This function \emph{almost} always makes |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 the same decision as the real interpreter main loop. |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 Arguments: \var{source} is the source string; \var{filename} is the |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 optional filename from which source was read, defaulting to |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 \code{"<input>"}; and \var{symbol} is the optional grammar start |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 symbol, which should be either \code{"single"} (the default) or |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 \code{"eval"}. |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 Return a code object (the same as \code{compile(\var{source}, |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 \var{filename}, \var{symbol})}) if the command is complete and valid; |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 return \code{None} if the command is incomplete; raise |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 \code{SyntaxError} if the command is a syntax error. |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 |
|
35b14d78c61d
added code.py; codehack.py is obsolete
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 \end{funcdesc} |
