diff options
author | Moshe Zadka <moshez@math.huji.ac.il> | 2000-11-30 12:31:03 (GMT) |
---|---|---|
committer | Moshe Zadka <moshez@math.huji.ac.il> | 2000-11-30 12:31:03 (GMT) |
commit | 1a62750eda22dcef1976f4a3dbaa886039cd2f92 (patch) | |
tree | 291193bd5c8e1c6cb83b1087cb2b935bf82e4a8c /Doc/lib | |
parent | 827bb9fb3c6c3889c046404df171a0b8f383eb23 (diff) | |
download | cpython-1a62750eda22dcef1976f4a3dbaa886039cd2f92.zip cpython-1a62750eda22dcef1976f4a3dbaa886039cd2f92.tar.gz cpython-1a62750eda22dcef1976f4a3dbaa886039cd2f92.tar.bz2 |
Added .first{item,value,key}() to dictionaries.
Complete with docos and tests.
OKed by Guido.
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libstdtypes.tex | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 91dd675..b66de07 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -783,8 +783,12 @@ arbitrary objects): \ttindex{has_key()} \ttindex{items()} \ttindex{keys()} + \ttindex{firstitem()} + \ttindex{firstkey()} \ttindex{update()} \ttindex{values()} + \ttindex{firstvalue()} + \ttindex{setdefault()} \ttindex{get()}} \begin{tableiii}{c|l|c}{code}{Operation}{Result}{Notes} @@ -804,11 +808,19 @@ arbitrary objects): \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} {(2)} + \lineiii{\var{a}.firstitem()} + {a (\var{key}, \var{value}) pair, the first one in \var{a}.items()} + {(2)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)} + \lineiii{\var{a}.firstkey()} + {the first element in \var{a}.keys()} + {(2)} \lineiii{\var{a}.update(\var{b})} {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}} {(3)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} + \lineiii{\var{a}.firstvalue()} + {the first element in \var{a}.values()} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} {\code{\var{a}[\var{k}]} if \code{\var{a}.has_key(\var{k})}, else \var{x}} |