From: Raymond Hettinger Date: Sun, 21 Aug 2005 11:27:35 +0000 (+0000) Subject: SF bug #1249837: container methods raise KeyError not IndexError X-Git-Tag: v2.4.2c1~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4a439c2f964b539d7b8e1f3fd3b811586e34077;p=thirdparty%2FPython%2Fcpython.git SF bug #1249837: container methods raise KeyError not IndexError Minor clarification. --- diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index 67ffe9ea1ee6..d78e546bf59f 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -1658,6 +1658,8 @@ If \var{key} is of an inappropriate type, \exception{TypeError} may be raised; if of a value outside the set of indexes for the sequence (after any special interpretation of negative values), \exception{IndexError} should be raised. +For mapping types, if \var{key} is missing (not in the container), +\exception{KeyError} should be raised. \note{\keyword{for} loops expect that an \exception{IndexError} will be raised for illegal indexes to allow proper detection of the end of the sequence.}