Skip to content

Commit a6ae70e

Browse files
committed
#17178: update any()/all() docstrings to document their behavior with empty iterables. Patch by Ankur Ankan.
1 parent 9fc6279 commit a6ae70e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Pehr Anderson
3333
Erik Andersén
3434
Oliver Andrich
3535
Ross Andrus
36+
Ankur Ankan
3637
Heidi Annexstad
3738
Éric Araujo
3839
Jeffrey Armstrong

Python/bltinmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ builtin_all(PyObject *self, PyObject *v)
120120
PyDoc_STRVAR(all_doc,
121121
"all(iterable) -> bool\n\
122122
\n\
123-
Return True if bool(x) is True for all values x in the iterable.");
123+
Return True if bool(x) is True for all values x in the iterable.\n\
124+
If the iterable is empty, return True.");
124125

125126
static PyObject *
126127
builtin_any(PyObject *self, PyObject *v)
@@ -162,7 +163,8 @@ builtin_any(PyObject *self, PyObject *v)
162163
PyDoc_STRVAR(any_doc,
163164
"any(iterable) -> bool\n\
164165
\n\
165-
Return True if bool(x) is True for any x in the iterable.");
166+
Return True if bool(x) is True for any x in the iterable.\n\
167+
If the iterable is empty, return False.");
166168

167169
static PyObject *
168170
builtin_apply(PyObject *self, PyObject *args)

0 commit comments

Comments
 (0)