On this page
operator.call
Prev: operator.attrgetter | Up: operator | Next: operator.concat
Rel: operator.abs, operator.add, operator.and_, operator.attrgetter
Ref: docs.python.org — operator.call
Tags: #public #python3 #stdlib #operator
Import
import operator
from operator import call
Signature & Overview
operator.call(obj, /, *args, **kwargs)
Same as obj(*args, **kwargs).
Usage
import operator
# Python 3.11+: functional form of obj(*args, **kwargs)
if hasattr(operator, "call"):
assert operator.call(pow, 2, 5) == 32
Gotchas
- Requires Python 3.11+: Useful with
map(operator.call, callbacks).
REPL Inspect
from operator import call
help(call)
Linked from
Related notes
- tuts/python3/stdlib_module/operator/abs Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/add Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/and_ Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/attrgetter Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/concat 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/contains shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/countOf shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/delitem shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/eq shared tags: #operator, #stdlib