[Python-checkins] r54489 - python/trunk/Doc/lib/libcollections.tex
andrew.kuchling
python-checkins at python.org
Wed Mar 21 17:57:36 CET 2007
Author: andrew.kuchling
Date: Wed Mar 21 17:57:32 2007
New Revision: 54489
Modified:
python/trunk/Doc/lib/libcollections.tex
Log:
Fix sentence, and fix typo in example
Modified: python/trunk/Doc/lib/libcollections.tex
==============================================================================
--- python/trunk/Doc/lib/libcollections.tex (original)
+++ python/trunk/Doc/lib/libcollections.tex Wed Mar 21 17:57:32 2007
@@ -377,12 +377,13 @@
The use cases are the same as those for tuples. The named factories
assign meaning to each tuple position and allow for more readable,
- self-documenting code. Can also be used to assign field names to tuples
+ self-documenting code. Named tuples can also be used to assign field names
+ to tuples
returned by the \module{csv} or \module{sqlite3} modules. For example:
\begin{verbatim}
import csv
- EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title deparment paygrade')
+ EmployeeRecord = NamedTuple('EmployeeRecord', 'name age title department paygrade')
for tup in csv.reader(open("employees.csv", "rb")):
print EmployeeRecord(*tup)
\end{verbatim}
More information about the Python-checkins
mailing list