Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9218a1

Browse files
committed
Remove the restriction on a mapping's .update() method.
1 parent 51acc8d commit e9218a1

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

Doc/lib/libstdtypes.tex

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -933,19 +933,19 @@ \subsection{Mapping Types \label{typesmapping}}
933933
\lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(3)}
934934
\lineiii{\var{a}.update(\var{b})}
935935
{\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}}
936-
{(4)}
936+
{}
937937
\lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(3)}
938938
\lineiii{\var{a}.get(\var{k}\optional{, \var{x}})}
939939
{\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}},
940940
else \var{x}}
941-
{(5)}
941+
{(4)}
942942
\lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})}
943943
{\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}},
944944
else \var{x} (also setting it)}
945-
{(6)}
945+
{(5)}
946946
\lineiii{\var{a}.popitem()}
947947
{remove and return an arbitrary (\var{key}, \var{value}) pair}
948-
{(7)}
948+
{(6)}
949949
\lineiii{\var{a}.iteritems()}
950950
{return an iterator over (\var{key}, \var{value}) pairs}
951951
{(2)}
@@ -972,17 +972,15 @@ \subsection{Mapping Types \label{typesmapping}}
972972
\var{key})} pairs using \function{zip()}: \samp{pairs =
973973
zip(\var{a}.values(), \var{a}.keys())}.
974974

975-
\item[(4)] \var{b} must be of the same type as \var{a}.
976-
977-
\item[(5)] Never raises an exception if \var{k} is not in the map,
975+
\item[(4)] Never raises an exception if \var{k} is not in the map,
978976
instead it returns \var{x}. \var{x} is optional; when \var{x} is not
979977
provided and \var{k} is not in the map, \code{None} is returned.
980978

981-
\item[(6)] \function{setdefault()} is like \function{get()}, except
979+
\item[(5)] \function{setdefault()} is like \function{get()}, except
982980
that if \var{k} is missing, \var{x} is both returned and inserted into
983981
the dictionary as the value of \var{k}.
984982

985-
\item[(7)] \function{popitem()} is useful to destructively iterate
983+
\item[(6)] \function{popitem()} is useful to destructively iterate
986984
over a dictionary, as often used in set algorithms.
987985
\end{description}
988986

0 commit comments

Comments
 (0)