summaryrefslogtreecommitdiffstats
path: root/Doc/tut
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/tut')
-rw-r--r--Doc/tut/tut.tex23
1 files changed, 21 insertions, 2 deletions
diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex
index f118e70..68929de 100644
--- a/Doc/tut/tut.tex
+++ b/Doc/tut/tut.tex
@@ -285,7 +285,9 @@ executable, like shell scripts, by putting the line
(assuming that the interpreter is on the user's \envvar{PATH}) at the
beginning of the script and giving the file an executable mode. The
-\samp{\#!} must be the first two characters of the file.
+\samp{\#!} must be the first two characters of the file. Note that
+the hash, or pound, character, \character{\#}, is used to start a
+comment in Python.
\subsection{The Interactive Startup File \label{startup}}
@@ -328,7 +330,7 @@ In the following examples, input and output are distinguished by the
presence or absence of prompts (\samp{>>> } and \samp{... }): to repeat
the example, you must type everything after the prompt, when the
prompt appears; lines that do not begin with a prompt are output from
-the interpreter.%
+the interpreter. %
%\footnote{
% I'd prefer to use different fonts to distinguish input
% from output, but the amount of LaTeX hacking that would require
@@ -337,6 +339,23 @@ the interpreter.%
Note that a secondary prompt on a line by itself in an example means
you must type a blank line; this is used to end a multi-line command.
+Many of the examples in this manual, even those entered at the
+interactive prompt, include comments. Comments in Python start with
+the hash character, \character{\#}, and extend to the end of the
+physical line. A comment may appear at the start of a line or
+following whitespace or code, but not within a string literal. A hash
+character within a string literal is just a hash character.
+
+Some examples:
+
+\begin{verbatim}
+# this is the first comment
+SPAM = 1 # and this is the second comment
+ # ... and now a third!
+STRING = "# This is not a comment."
+\end{verbatim}
+
+
\section{Using Python as a Calculator \label{calculator}}
Let's try some simple Python commands. Start the interpreter and wait