[Python-checkins] gh-89682: [doc] reword docstring of __contains__ to clarify that it returns a bool (GH-29043)

iritkatriel webhook-mailer at python.org
Sat Nov 26 17:24:09 EST 2022


https://github.com/python/cpython/commit/25bc115df9d0e82309852609a83b5ab7f804cdc1
commit: 25bc115df9d0e82309852609a83b5ab7f804cdc1
branch: main
author: Ivan Savov <ivan.savov at gmail.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2022-11-26T22:24:04Z
summary:

gh-89682: [doc] reword docstring of __contains__ to clarify that it returns a bool (GH-29043)

files:
A Misc/NEWS.d/next/Documentation/2022-11-26-21-43-05.gh-issue-89682.DhKoTM.rst
M Objects/typeobject.c

diff --git a/Misc/NEWS.d/next/Documentation/2022-11-26-21-43-05.gh-issue-89682.DhKoTM.rst b/Misc/NEWS.d/next/Documentation/2022-11-26-21-43-05.gh-issue-89682.DhKoTM.rst
new file mode 100644
index 000000000000..46be065b6539
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2022-11-26-21-43-05.gh-issue-89682.DhKoTM.rst
@@ -0,0 +1 @@
+Reworded docstring of the default ``__contains__`` to clarify that it returns a :class:`bool`.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index b993aa405f6b..a4974a1b4f71 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -8741,7 +8741,7 @@ static pytype_slotdef slotdefs[] = {
     SQSLOT(__delitem__, sq_ass_item, slot_sq_ass_item, wrap_sq_delitem,
            "__delitem__($self, key, /)\n--\n\nDelete self[key]."),
     SQSLOT(__contains__, sq_contains, slot_sq_contains, wrap_objobjproc,
-           "__contains__($self, key, /)\n--\n\nReturn key in self."),
+           "__contains__($self, key, /)\n--\n\nReturn bool(key in self)."),
     SQSLOT(__iadd__, sq_inplace_concat, NULL,
            wrap_binaryfunc,
            "__iadd__($self, value, /)\n--\n\nImplement self+=value."),



More information about the Python-checkins mailing list