Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 625d70a

Browse files
committed
Fix references to the built-in compile() that don't include the
filename parameter. Noted by Randall Hopper <[email protected]>.
1 parent 35784df commit 625d70a

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Doc/lib/libparser.tex

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,18 @@ \subsection{Creating AST Objects \label{Creating ASTs}}
109109

110110
\begin{funcdesc}{expr}{source}
111111
The \function{expr()} function parses the parameter \var{source}
112-
as if it were an input to \samp{compile(\var{source}, 'eval')}. If
113-
the parse succeeds, an AST object is created to hold the internal
114-
parse tree representation, otherwise an appropriate exception is
115-
thrown.
112+
as if it were an input to \samp{compile(\var{source}, 'file.py',
113+
'eval')}. If the parse succeeds, an AST object is created to hold the
114+
internal parse tree representation, otherwise an appropriate exception
115+
is thrown.
116116
\end{funcdesc}
117117

118118
\begin{funcdesc}{suite}{source}
119119
The \function{suite()} function parses the parameter \var{source}
120-
as if it were an input to \samp{compile(\var{source}, 'exec')}. If
121-
the parse succeeds, an AST object is created to hold the internal
122-
parse tree representation, otherwise an appropriate exception is
123-
thrown.
120+
as if it were an input to \samp{compile(\var{source}, 'file.py',
121+
'exec')}. If the parse succeeds, an AST object is created to hold the
122+
internal parse tree representation, otherwise an appropriate exception
123+
is thrown.
124124
\end{funcdesc}
125125

126126
\begin{funcdesc}{sequence2ast}{sequence}
@@ -323,7 +323,7 @@ \subsubsection{Emulation of \function{compile()}}
323323
intermediate data structure is equivalent to the code
324324

325325
\begin{verbatim}
326-
>>> code = compile('a + 5', 'eval')
326+
>>> code = compile('a + 5', 'file.py', 'eval')
327327
>>> a = 5
328328
>>> eval(code)
329329
10
@@ -336,7 +336,7 @@ \subsubsection{Emulation of \function{compile()}}
336336
\begin{verbatim}
337337
>>> import parser
338338
>>> ast = parser.expr('a + 5')
339-
>>> code = ast.compile()
339+
>>> code = ast.compile('file.py')
340340
>>> a = 5
341341
>>> eval(code)
342342
10

0 commit comments

Comments
 (0)