[docs] [issue32899] Not documented: key in dict test may raise TypeError

Raymond Hettinger report at bugs.python.org
Wed Feb 21 18:40:20 EST 2018

Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

In general, Python functions don't document all possible exceptions.  One reason is that it would lead to substantial redundancy in the docs.  Another reason is that functions generally don't know all the possible exceptions that can be raised because that can be controlled determined by the data itself.  Also, the docs try to focus on core functionality and not drown out the message with side details.

For comparison, look at str.startswith() or math.cos() which can raise a TypeError if the input type is incorrect.  There is no reason to discuss that in the docs because most functions raise a TypeError when the type is incorrect.  This is more of a general FAQ than a function by function documentation issue.

resolution:  -> rejected
stage:  -> resolved
status: open -> closed

Python tracker <report at bugs.python.org>

More information about the docs mailing list