On this page
operator.is_not_none
Prev: operator.is_not | Up: operator | Next: operator.isub
Rel: operator.abs, operator.add, operator.and_, operator.attrgetter
Ref: docs.python.org — operator.is_not_none
Tags: #public #python3 #stdlib #operator
Import
import operator
from operator import is_not_none
Signature & Overview
operator.is_not_none(a, /)
Same as a is not None.
Usage
import operator
# Python 3.14+: functional form of `a is not None`
if hasattr(operator, "is_not_none"):
assert operator.is_not_none(0) is True and operator.is_not_none(None) is False
Gotchas
- Requires Python 3.14+: Great with
filter(operator.is_not_none, items)(unlikefilter(None, items)which also drops0and"").
REPL Inspect
from operator import is_not_none
help(is_not_none)
Linked from
Related notes
- tuts/python3/stdlib_module/operator/is_not Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/isub Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/operator/abs Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/add Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/and_ Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/attrgetter Linked here; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/call shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/concat shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/contains shared tags: #operator, #stdlib