Commit d36de78c authored by Raymond Hettinger's avatar Raymond Hettinger

SF bug #1249837: container methods raise KeyError not IndexError

Minor clarification.
parent cc5b79fc
...@@ -1658,6 +1658,8 @@ If \var{key} is of an inappropriate type, \exception{TypeError} may be ...@@ -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 raised; if of a value outside the set of indexes for the sequence
(after any special interpretation of negative values), (after any special interpretation of negative values),
\exception{IndexError} should be raised. \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 \note{\keyword{for} loops expect that an
\exception{IndexError} will be raised for illegal indexes to allow \exception{IndexError} will be raised for illegal indexes to allow
proper detection of the end of the sequence.} proper detection of the end of the sequence.}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment