[Python-checkins] Improve docstring for set.discard() (GH-31315)
rhettinger
webhook-mailer at python.org
Sun Feb 13 16:43:19 EST 2022
https://github.com/python/cpython/commit/0ae40191793da1877a12d512f0116d99301b2c51
commit: 0ae40191793da1877a12d512f0116d99301b2c51
branch: main
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2022-02-13T15:42:59-06:00
summary:
Improve docstring for set.discard() (GH-31315)
files:
M Objects/setobject.c
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 0dd28402afbd2..c65b7d5d21115 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1930,7 +1930,8 @@ set_discard(PySetObject *so, PyObject *key)
PyDoc_STRVAR(discard_doc,
"Remove an element from a set if it is a member.\n\
\n\
-If the element is not a member, do nothing.");
+Unlike set.remove(), the discard() method does not raise\n\
+an exception when an element is missing from the set.");
static PyObject *
set_reduce(PySetObject *so, PyObject *Py_UNUSED(ignored))
More information about the Python-checkins
mailing list