diff options
author | Raymond Hettinger <python@rcn.com> | 2002-11-27 07:29:33 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-11-27 07:29:33 (GMT) |
commit | e33d3df03079d704edbe159be079dc387058f044 (patch) | |
tree | b9b68ea6479278b215f1ed03ee75ac9e4fcc03ce /Doc/lib/libstdtypes.tex | |
parent | e9cfcef71eec755ad38a0764336920ecebb76344 (diff) | |
download | cpython-e33d3df03079d704edbe159be079dc387058f044.zip cpython-e33d3df03079d704edbe159be079dc387058f044.tar.gz cpython-e33d3df03079d704edbe159be079dc387058f044.tar.bz2 |
SF Patch 643443. Added dict.fromkeys(iterable, value=None), a class
method for constructing new dictionaries from sequences of keys.
Diffstat (limited to 'Doc/lib/libstdtypes.tex')
-rw-r--r-- | Doc/lib/libstdtypes.tex | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index eb12aa7..6f9e453 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -1055,8 +1055,11 @@ arbitrary objects): {(3)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)} \lineiii{\var{a}.update(\var{b})} - {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}} + {\code{for \var{k} in \var{b}.keys(): \var{a}[\var{k}] = \var{b}[\var{k}]}} {} + \lineiii{\var{a}.fromkeys(\var{seq}\optional{, \var{value}})} + {Creates a new dictionary with keys from \var{seq} and values set to \var{value}} + {(7)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, @@ -1116,6 +1119,10 @@ the dictionary as the value of \var{k}. over a dictionary, as often used in set algorithms. \end{description} +\item[(7)] \function{fromkeys()} is a class method that returns a +new dictionary. \var{value} defaults to \code{None}. \versionadded{2.3} +\end{description} + \subsection{File Objects \label{bltin-file-objects}} |