On this page
any
Prev: anext | Up: __builtins__ | Next: ascii
Rel: all, enumerate, filter, iter, aiter
Ref: docs.python.org — any
Tags: #public #python3 #builtins
Import & Availability
# Built-in (available globally without import)
from builtins import any
Overview & Signature
any(iterable, /)
Return True if bool(x) is True for any x in the iterable.
Usage
assert any(ch.isdigit() for ch in "abc3def") is True
assert any([]) is False
Gotchas
- Short-circuits on the first truthy item: Ideal with generator expressions over large iterables.
REPL Inspect
help(any)
Linked from
- tuts/python3/__builtins__
- tuts/python3/__builtins__/__builtins__
- tuts/python3/__builtins__/aiter
- tuts/python3/__builtins__/all
- tuts/python3/__builtins__/anext
- tuts/python3/__builtins__/ascii
- tuts/python3/__builtins__/enumerate
- tuts/python3/__builtins__/filter
- tuts/python3/__builtins__/iter
- tuts/python3/__builtins__/len
- tuts/python3/__builtins__/map
- tuts/python3/__builtins__/next
- tuts/python3/__builtins__/reversed
- tuts/python3/__builtins__/sorted
- tuts/python3/__builtins__/zip
Related notes
- tuts/python3/__builtins__/__builtins__ Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/aiter Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/all Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/anext Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/ascii Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/enumerate Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/filter Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/iter Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__ links to this page; shared tags: #builtins
- tuts/python3/__builtins__/len links to this page; shared tags: #builtins