diff options
author | Guido van Rossum <guido@python.org> | 1997-05-28 19:32:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-05-28 19:32:11 (GMT) |
commit | 6102b51f2b466cf6eea0f11e24892a39db1e4bdc (patch) | |
tree | cc0821cf3059c4a129397788feebab9c8d5e17e7 /Doc | |
parent | f7cea10f80093662b80ea82b4ca368681dd6873a (diff) | |
download | cpython-6102b51f2b466cf6eea0f11e24892a39db1e4bdc.zip cpython-6102b51f2b466cf6eea0f11e24892a39db1e4bdc.tar.gz cpython-6102b51f2b466cf6eea0f11e24892a39db1e4bdc.tar.bz2 |
Added copy() and absorb().
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libtypes.tex | 7 | ||||
-rw-r--r-- | Doc/libtypes.tex | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/Doc/lib/libtypes.tex b/Doc/lib/libtypes.tex index 75390f8..b780375 100644 --- a/Doc/lib/libtypes.tex +++ b/Doc/lib/libtypes.tex @@ -504,10 +504,13 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object): \lineiii{\var{a}[\var{k}]}{the item of \var{a} with key \var{k}}{(1)} \lineiii{\var{a}[\var{k}] = \var{x}}{set \code{\var{a}[\var{k}]} to \var{x}}{} \lineiii{del \var{a}[\var{k}]}{remove \code{\var{a}[\var{k}]} from \var{a}}{(1)} + \lineiii{\var{a}.absorb(b)}{\code{for k, v in b.items(): a[k] = v}}{(3)} + \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} + \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} + \lineiii{\var{a}.has_key(\var{k})}{\code{1} if \var{a} has a key \var{k}, else \code{0}}{} \lineiii{\var{a}.items()}{a copy of \var{a}'s list of (key, item) pairs}{(2)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} - \lineiii{\var{a}.has_key(\var{k})}{\code{1} if \var{a} has a key \var{k}, else \code{0}}{} \end{tableiii} \indexiii{operations on}{mapping}{types} \indexiii{operations on}{dictionary}{type} @@ -523,6 +526,8 @@ Notes: \item[(1)] Raises an exception if \var{k} is not in the map. \item[(2)] Keys and values are listed in random order. + +\item[(3)] \code{b} must be of the same type as \code{a}. \end{description} \subsection{Other Built-in Types} diff --git a/Doc/libtypes.tex b/Doc/libtypes.tex index 75390f8..b780375 100644 --- a/Doc/libtypes.tex +++ b/Doc/libtypes.tex @@ -504,10 +504,13 @@ mapping, \var{k} is a key and \var{x} is an arbitrary object): \lineiii{\var{a}[\var{k}]}{the item of \var{a} with key \var{k}}{(1)} \lineiii{\var{a}[\var{k}] = \var{x}}{set \code{\var{a}[\var{k}]} to \var{x}}{} \lineiii{del \var{a}[\var{k}]}{remove \code{\var{a}[\var{k}]} from \var{a}}{(1)} + \lineiii{\var{a}.absorb(b)}{\code{for k, v in b.items(): a[k] = v}}{(3)} + \lineiii{\var{a}.clear()}{remove all items from \code{a}}{} + \lineiii{\var{a}.copy()}{a (shallow) copy of \code{a}}{} + \lineiii{\var{a}.has_key(\var{k})}{\code{1} if \var{a} has a key \var{k}, else \code{0}}{} \lineiii{\var{a}.items()}{a copy of \var{a}'s list of (key, item) pairs}{(2)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} - \lineiii{\var{a}.has_key(\var{k})}{\code{1} if \var{a} has a key \var{k}, else \code{0}}{} \end{tableiii} \indexiii{operations on}{mapping}{types} \indexiii{operations on}{dictionary}{type} @@ -523,6 +526,8 @@ Notes: \item[(1)] Raises an exception if \var{k} is not in the map. \item[(2)] Keys and values are listed in random order. + +\item[(3)] \code{b} must be of the same type as \code{a}. \end{description} \subsection{Other Built-in Types} |