SF bug #1249837: container methods raise KeyError not IndexError

Minor clarification.
This commit is contained in:
Raymond Hettinger 2005-08-21 11:26:14 +00:00
parent a710b331da
commit a30616a88d
1 changed files with 2 additions and 0 deletions

View File

@ -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.}