Skip to content

Commit b19ed57

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

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Erik Andersén
3737
Oliver Andrich
3838
Ross Andrus
3939
Jérémy Anger
40+
Ankur Ankan
4041
Jon Anglin
4142
Heidi Annexstad
4243
Éric Araujo

Python/bltinmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ builtin_all(PyObject *self, PyObject *v)
262262
PyDoc_STRVAR(all_doc,
263263
"all(iterable) -> bool\n\
264264
\n\
265-
Return True if bool(x) is True for all values x in the iterable.");
265+
Return True if bool(x) is True for all values x in the iterable.\n\
266+
If the iterable is empty, return True.");
266267

267268
static PyObject *
268269
builtin_any(PyObject *self, PyObject *v)
@@ -304,7 +305,8 @@ builtin_any(PyObject *self, PyObject *v)
304305
PyDoc_STRVAR(any_doc,
305306
"any(iterable) -> bool\n\
306307
\n\
307-
Return True if bool(x) is True for any x in the iterable.");
308+
Return True if bool(x) is True for any x in the iterable.\n\
309+
If the iterable is empty, return False.");
308310

309311
static PyObject *
310312
builtin_ascii(PyObject *self, PyObject *v)

0 commit comments

Comments
 (0)