@@ -246,8 +246,8 @@ \subsection{Error Handling}
246246
247247\subsection {The Module Search Path }
248248
249- When a module named {\tt foo } is imported, the interpreter searches
250- for a file named {\tt foo .py} in the list of directories specified by
249+ When a module named {\tt spam } is imported, the interpreter searches
250+ for a file named {\tt spam .py} in the list of directories specified by
251251the environment variable {\tt PYTHONPATH}. It has the same syntax as
252252the {\UNIX } shell variable {\tt PATH}, i.e., a list of colon-separated
253253directory names. When {\tt PYTHONPATH} is not set, or when the file
@@ -263,17 +263,17 @@ \subsection{The Module Search Path}
263263\subsection {`` Compiled'' Python files }
264264
265265As an important speed-up of the start-up time for short programs that
266- use a lot of standard modules, if a file called {\tt foo .pyc} exists
267- in the directory where {\tt foo .py} is found, this is assumed to
268- contain an already-`` compiled'' version of the module {\tt foo }. The
269- modification time of the version of {\tt foo .py} used to create {\tt
270- foo .pyc} is recorded in {\tt foo .pyc}, and the file is ignored if
266+ use a lot of standard modules, if a file called {\tt spam .pyc} exists
267+ in the directory where {\tt spam .py} is found, this is assumed to
268+ contain an already-`` compiled'' version of the module {\tt spam }. The
269+ modification time of the version of {\tt spam .py} used to create {\tt
270+ spam .pyc} is recorded in {\tt spam .pyc}, and the file is ignored if
271271these don't match.
272272
273- Whenever {\tt foo .py} is successfully compiled, an attempt is made to
274- write the compiled version to {\tt foo .pyc}. It is not an error if
273+ Whenever {\tt spam .py} is successfully compiled, an attempt is made to
274+ write the compiled version to {\tt spam .pyc}. It is not an error if
275275this attempt fails; if for any reason the file is not written
276- completely, the resulting {\tt foo .pyc} file will be recognized as
276+ completely, the resulting {\tt spam .pyc} file will be recognized as
277277invalid and thus ignored later.
278278
279279\subsection {Executable Python scripts }
@@ -496,8 +496,8 @@ \subsection{Strings}
496496single quotes or double quotes:
497497
498498\bcode \begin {verbatim }
499- >>> 'foo bar '
500- 'foo bar '
499+ >>> 'spam eggs '
500+ 'spam eggs '
501501>>> 'doesn\'t'
502502"doesn't"
503503>>> "doesn't"
@@ -660,9 +660,9 @@ \subsection{Lists}
660660square brackets. List items need not all have the same type.
661661
662662\bcode \begin {verbatim }
663- >>> a = ['foo ', 'bar ', 100, 1234]
663+ >>> a = ['spam ', 'eggs ', 100, 1234]
664664>>> a
665- ['foo ', 'bar ', 100, 1234]
665+ ['spam ', 'eggs ', 100, 1234]
666666>>>
667667\end {verbatim }\ecode
668668%
@@ -671,17 +671,17 @@ \subsection{Lists}
671671
672672\bcode \begin {verbatim }
673673>>> a[0]
674- 'foo '
674+ 'spam '
675675>>> a[3]
6766761234
677677>>> a[-2]
678678100
679679>>> a[1:-1]
680- ['bar ', 100]
681- >>> a[:2] + ['bletch ', 2*2]
682- ['foo ', 'bar ', 'bletch ', 4]
680+ ['eggs ', 100]
681+ >>> a[:2] + ['bacon ', 2*2]
682+ ['spam ', 'eggs ', 'bacon ', 4]
683683>>> 3*a[:3] + ['Boe!']
684- ['foo ', 'bar ', 100, 'foo ', 'bar ', 100, 'foo ', 'bar ', 100, 'Boe!']
684+ ['spam ', 'eggs ', 100, 'spam ', 'eggs ', 100, 'spam ', 'eggs ', 100, 'Boe!']
685685>>>
686686\end {verbatim }\ecode
687687%
@@ -690,10 +690,10 @@ \subsection{Lists}
690690
691691\bcode \begin {verbatim }
692692>>> a
693- ['foo ', 'bar ', 100, 1234]
693+ ['spam ', 'eggs ', 100, 1234]
694694>>> a[2] = a[2] + 23
695695>>> a
696- ['foo ', 'bar ', 123, 1234]
696+ ['spam ', 'eggs ', 123, 1234]
697697>>>
698698\end {verbatim }\ecode
699699%
@@ -1287,7 +1287,7 @@ \section{Tuples and Sequences}
12871287square brackets:
12881288
12891289\bcode \begin {verbatim }
1290- >>> a = ['foo ', 'bar ', 100, 1234]
1290+ >>> a = ['spam ', 'eggs ', 100, 1234]
12911291>>> [a1, a2, a3, a4] = a
12921292>>>
12931293\end {verbatim }\ecode
@@ -1697,8 +1697,8 @@ \chapter{Output Formatting}
16971697>>> print hellos
16981698'hello, world\012'
16991699>>> # The argument of reverse quotes may be a tuple:
1700- ... `x, y, ('foo ', 'bar ')`
1701- "(31.4, 40000, ('foo ', 'bar '))"
1700+ ... `x, y, ('spam ', 'eggs ')`
1701+ "(31.4, 40000, ('spam ', 'eggs '))"
17021702>>>
17031703\end {verbatim }\ecode
17041704%
@@ -1809,10 +1809,10 @@ \section{Exceptions}
18091809Traceback (innermost last):
18101810 File "<stdin>", line 1
18111811ZeroDivisionError: integer division or modulo
1812- >>> 4 + foo *3
1812+ >>> 4 + spam *3
18131813Traceback (innermost last):
18141814 File "<stdin>", line 1
1815- NameError: foo
1815+ NameError: spam
18161816>>> '2' + 2
18171817Traceback (innermost last):
18181818 File "<stdin>", line 1
@@ -1919,11 +1919,11 @@ \section{Handling Exceptions}
19191919
19201920\bcode \begin {verbatim }
19211921>>> try:
1922- ... foo ()
1922+ ... spam ()
19231923... except NameError, x:
19241924... print 'name', x, 'undefined'
19251925...
1926- name foo undefined
1926+ name spam undefined
19271927>>>
19281928\end {verbatim }\ecode
19291929%
@@ -3009,8 +3009,8 @@ \section{Miscellaneous New Built-in Functions}
30093009name. The function \verb \setattr(x, name, value) \ assigns a value to
30103010an object's attribute with the given name. These three functions are
30113011useful if the attribute names are not known beforehand. Note that
3012- \verb \getattr(x, 'foo ') \ is equivalent to \verb \x.foo \, and
3013- \verb \setattr(x, 'foo ', y) \ is equivalent to \verb \x.foo = y \. By
3012+ \verb \getattr(x, 'spam ') \ is equivalent to \verb \x.spam \, and
3013+ \verb \setattr(x, 'spam ', y) \ is equivalent to \verb \x.spam = y \. By
30143014definition, \verb \hasattr(x, name) \ returns true if and only if
30153015\verb \getattr(x, name) \ returns without raising an exception.
30163016
0 commit comments