New submission from xitop <reg.b...@poti.sk>: I'd like to suggest an addition to the documentation of the "key in dict" operation.
Current version found at https://docs.python.org/3/library/stdtypes.html#dict says only: --- 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@python components: Documentation messages: 312506 nosy: docs@python, xitop priority: normal severity: normal status: open title: Not documented: key in dict test may raise TypeError type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32899> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com