[docs] [issue32899] Not documented: key in dict test may raise TypeError
report at bugs.python.org
Wed Feb 21 15:01:23 EST 2018
New submission from xitop <reg.bugs at poti.sk>:
I'd like to suggest an addition to the documentation of the "key in dict" operation.
Current version found at
key in d
Return True if d has a key key, else False.
This is not precise. TypeError is also a possible outcome. It happens when the key is unhashable. Unsure whether the description is incomplete or the membership test has a bug I submitted the issue 32675 in January. The issue was closed with resolution of "not a bug".
If it is indded the intended behaviour, I think it needs to be documented in order to prevent further misunderstandings. Before the issue 32675 I believed a membership test is failsafe, because the definition of __contains__ clearly defines the return value as either True or False.
assignee: docs at python
nosy: docs at python, xitop
title: Not documented: key in dict test may raise TypeError
Python tracker <report at bugs.python.org>
More information about the docs