summaryrefslogtreecommitdiff
path: root/Doc/tutorial
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/datastructures.rst2
-rw-r--r--Doc/tutorial/interpreter.rst8
-rw-r--r--Doc/tutorial/introduction.rst3
-rw-r--r--Doc/tutorial/stdlib.rst2
-rw-r--r--Doc/tutorial/stdlib2.rst8
5 files changed, 14 insertions, 9 deletions
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index ed81ade5b1..bd661e245c 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -186,7 +186,7 @@ We can obtain the same result with::
squares = [x**2 for x in range(10)]
-This is also equivalent to ``squares = map(lambda x: x**2, range(10))``,
+This is also equivalent to ``squares = list(map(lambda x: x**2, range(10)))``,
but it's more concise and readable.
A list comprehension consists of brackets containing an expression followed
diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst
index 8f08cd8fda..cdc2bf2f1a 100644
--- a/Doc/tutorial/interpreter.rst
+++ b/Doc/tutorial/interpreter.rst
@@ -12,7 +12,9 @@ Invoking the Interpreter
The Python interpreter is usually installed as :file:`/usr/local/bin/python3.3`
on those machines where it is available; putting :file:`/usr/local/bin` in your
-Unix shell's search path makes it possible to start it by typing the command ::
+Unix shell's search path makes it possible to start it by typing the command:
+
+.. code-block:: text
python3.3
@@ -94,8 +96,8 @@ prints a welcome message stating its version number and a copyright notice
before printing the first prompt::
$ python3.3
- Python 3.3 (py3k, Sep 12 2007, 12:21:02)
- [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
+ Python 3.3 (default, Sep 24 2012, 09:25:04)
+ [GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst
index 43ea7aa371..b6d94accfd 100644
--- a/Doc/tutorial/introduction.rst
+++ b/Doc/tutorial/introduction.rst
@@ -94,8 +94,7 @@ A value can be assigned to several variables simultaneously::
Variables must be "defined" (assigned a value) before they can be used, or an
error will occur::
- >>> # try to access an undefined variable
- ... n
+ >>> n # try to access an undefined variable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'n' is not defined
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index 500ca7f623..b5771f6d5c 100644
--- a/Doc/tutorial/stdlib.rst
+++ b/Doc/tutorial/stdlib.rst
@@ -148,7 +148,7 @@ Internet Access
There are a number of modules for accessing the internet and processing internet
protocols. Two of the simplest are :mod:`urllib.request` for retrieving data
-from urls and :mod:`smtplib` for sending mail::
+from URLs and :mod:`smtplib` for sending mail::
>>> from urllib.request import urlopen
>>> for line in urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst
index 85c88dc23f..6a48984c08 100644
--- a/Doc/tutorial/stdlib2.rst
+++ b/Doc/tutorial/stdlib2.rst
@@ -95,7 +95,7 @@ placeholders unchanged if data is missing::
>>> d = dict(item='unladen swallow')
>>> t.substitute(d)
Traceback (most recent call last):
- . . .
+ ...
KeyError: 'owner'
>>> t.safe_substitute(d)
'Return the unladen swallow to $owner.'
@@ -220,7 +220,9 @@ At its simplest, log messages are sent to a file or to ``sys.stderr``::
logging.error('Error occurred')
logging.critical('Critical error -- shutting down')
-This produces the following output::
+This produces the following output:
+
+.. code-block:: none
WARNING:root:Warning:config file server.conf not found
ERROR:root:Error occurred
@@ -311,6 +313,8 @@ tree searches::
>>> print("Handling", d.popleft())
Handling task1
+::
+
unsearched = deque([starting_node])
def breadth_first_search(unsearched):
node = unsearched.popleft()