summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2007-03-21 16:59:20 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2007-03-21 16:59:20 (GMT)
commit4732c6e1643443f7dc76290f5cc84b862ec3f667 (patch)
treeb1c15f4b957a314aae6226f68a59a558ffe41c87
parent7af1bdf619c28e949b8d9a534f481fb591f19b7c (diff)
downloadcpython-4732c6e1643443f7dc76290f5cc84b862ec3f667.zip
cpython-4732c6e1643443f7dc76290f5cc84b862ec3f667.tar.gz
cpython-4732c6e1643443f7dc76290f5cc84b862ec3f667.tar.bz2
Put code examples at left margin instead of indenting them
-rw-r--r--Doc/lib/libcollections.tex38
1 files changed, 19 insertions, 19 deletions
diff --git a/Doc/lib/libcollections.tex b/Doc/lib/libcollections.tex
index b73805a..9e755b1 100644
--- a/Doc/lib/libcollections.tex
+++ b/Doc/lib/libcollections.tex
@@ -360,20 +360,20 @@ Setting the \member{default_factory} to \class{set} makes the
Example:
\begin{verbatim}
- >>> Point = NamedTuple('Point', 'x y')
- >>> Point.__doc__ # docstring for the new datatype
- 'Point(x, y)'
- >>> p = Point(11, y=22) # instantiate with positional or keyword arguments
- >>> p[0] + p[1] # works just like the tuple (11, 22)
- 33
- >>> x, y = p # unpacks just like a tuple
- >>> x, y
- (11, 22)
- >>> p.x + p.y # fields also accessable by name
- 33
- >>> p # readable __repr__ with name=value style
- Point(x=11, y=22)
- \end{verbatim}
+>>> Point = NamedTuple('Point', 'x y')
+>>> Point.__doc__ # docstring for the new datatype
+'Point(x, y)'
+>>> p = Point(11, y=22) # instantiate with positional or keyword arguments
+>>> p[0] + p[1] # works just like the tuple (11, 22)
+33
+>>> x, y = p # unpacks just like a tuple
+>>> x, y
+(11, 22)
+>>> p.x + p.y # fields also accessable by name
+33
+>>> p # readable __repr__ with name=value style
+Point(x=11, y=22)
+\end{verbatim}
The use cases are the same as those for tuples. The named factories
assign meaning to each tuple position and allow for more readable,
@@ -382,10 +382,10 @@ Setting the \member{default_factory} to \class{set} makes the
returned by the \module{csv} or \module{sqlite3} modules. For example:
\begin{verbatim}
- import csv
- EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title department paygrade')
- for tup in csv.reader(open("employees.csv", "rb")):
- print EmployeeRecord(*tup)
- \end{verbatim}
+import csv
+EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title department paygrade')
+for tup in csv.reader(open("employees.csv", "rb")):
+ print EmployeeRecord(*tup)
+\end{verbatim}
\end{funcdesc}