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

Skip to content

Commit 6b4593e

Browse files
committed
Update to add get() and setdefault() as supported mapping operations, and
add a list of the mapping methods which are not supported (per Barry's comments).
1 parent cf71fef commit 6b4593e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Doc/lib/librfc822.tex

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,17 @@ \subsection{Message Objects \label{message-objects}}
215215
In particular: \code{\var{m}[name]} is like
216216
\code{\var{m}.getheader(name)} but raises \exception{KeyError} if
217217
there is no matching header; and \code{len(\var{m})},
218+
\code{\var{m}.get(name\optional{, deafult})},
218219
\code{\var{m}.has_key(name)}, \code{\var{m}.keys()},
219-
\code{\var{m}.values()} and \code{\var{m}.items()} act as expected
220+
\code{\var{m}.values()} \code{\var{m}.items()}, and
221+
\code{\var{m}.setdefault(name\optional{, default})} act as expected
220222
(and consistently). \class{Message} instances also support the
221223
mapping writable interface \code{\var{m}[name] = value} and \code{del
222-
\var{m}[name]}.
224+
\var{m}[name]}. \class{Message} objects do not support the
225+
\method{clear()}, \method{copy()}, \method{popitem()}, or
226+
\method{update()} methods of the mapping interface. (Support for
227+
\method{.get()} and \method{.setdefault()} was only added in Python
228+
2.2.)
223229

224230
Finally, \class{Message} instances have two public instance variables:
225231

0 commit comments

Comments
 (0)