Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7af1bdf6
Commit
7af1bdf6
authored
Mar 21, 2007
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sentence, and fix typo in example
parent
8aa30927
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
Doc/lib/libcollections.tex
Doc/lib/libcollections.tex
+3
-2
No files found.
Doc/lib/libcollections.tex
View file @
7af1bdf6
...
...
@@ -377,12 +377,13 @@ Setting the \member{default_factory} to \class{set} makes the
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 depar
t
ment paygrade')
for tup in csv.reader(open("employees.csv", "rb")):
print EmployeeRecord(*tup)
\end{verbatim}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment