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
dc0f00ad
Commit
dc0f00ad
authored
Oct 06, 1997
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the mapping object's new get() method.
parent
fc3e61cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
Doc/lib/libtypes.tex
Doc/lib/libtypes.tex
+5
-0
Doc/libtypes.tex
Doc/libtypes.tex
+5
-0
No files found.
Doc/lib/libtypes.tex
View file @
dc0f00ad
...
...
@@ -528,6 +528,7 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object):
\lineiii
{
\var
{
a
}
.keys()
}{
a copy of
\var
{
a
}
's list of keys
}{
(2)
}
\lineiii
{
\var
{
a
}
.update(b)
}{
\code
{
for k, v in b.items(): a[k] = v
}}{
(3)
}
\lineiii
{
\var
{
a
}
.values()
}{
a copy of
\var
{
a
}
's list of values
}{
(2)
}
\lineiii
{
\var
{
a
}
.get(k, f)
}{
the item of
\var
{
a
}
with key
\var
{
k
}}{
(4)
}
\end{tableiii}
\indexiii
{
operations on
}{
mapping
}{
types
}
\indexiii
{
operations on
}{
dictionary
}{
type
}
...
...
@@ -545,6 +546,10 @@ Notes:
\item
[(2)]
Keys and values are listed in random order.
\item
[(3)]
\code
{
b
}
must be of the same type as
\code
{
a
}
.
\item
[(4)]
Never raises an exception if
\var
{
k
}
is not in the map,
instead it returns
\var
{
f
}
.
\var
{
f
}
is optional, when not provided
and
\var
{
k
}
is not in the map,
\code
{
None
}
is returned.
\end{description}
\subsection
{
Other Built-in Types
}
...
...
Doc/libtypes.tex
View file @
dc0f00ad
...
...
@@ -528,6 +528,7 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object):
\lineiii
{
\var
{
a
}
.keys()
}{
a copy of
\var
{
a
}
's list of keys
}{
(2)
}
\lineiii
{
\var
{
a
}
.update(b)
}{
\code
{
for k, v in b.items(): a[k] = v
}}{
(3)
}
\lineiii
{
\var
{
a
}
.values()
}{
a copy of
\var
{
a
}
's list of values
}{
(2)
}
\lineiii
{
\var
{
a
}
.get(k, f)
}{
the item of
\var
{
a
}
with key
\var
{
k
}}{
(4)
}
\end{tableiii}
\indexiii
{
operations on
}{
mapping
}{
types
}
\indexiii
{
operations on
}{
dictionary
}{
type
}
...
...
@@ -545,6 +546,10 @@ Notes:
\item
[(2)]
Keys and values are listed in random order.
\item
[(3)]
\code
{
b
}
must be of the same type as
\code
{
a
}
.
\item
[(4)]
Never raises an exception if
\var
{
k
}
is not in the map,
instead it returns
\var
{
f
}
.
\var
{
f
}
is optional, when not provided
and
\var
{
k
}
is not in the map,
\code
{
None
}
is returned.
\end{description}
\subsection
{
Other Built-in Types
}
...
...
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