On this page
operator.add
Prev: operator.abs | Up: operator | Next: operator.and_
Rel: operator.abs, operator.and_, operator.attrgetter, operator.call
Ref: docs.python.org — operator.add
Tags: #public #python3 #stdlib #operator
Import
import operator
from operator import add
Signature & Overview
operator.add(a, b, /)
Same as a + b.
Usage
import functools, operator
assert operator.add(2, 3) == 5
assert functools.reduce(operator.add, ["a", "b", "c"]) == "abc"
Gotchas
- Faster than
lambda a, b: a + binmap()/reduce()/itertools.accumulate().
REPL Inspect
from operator import add
help(add)
Linked from
- tuts/python3/stdlib_module/operator
- tuts/python3/stdlib_module/operator/abs
- tuts/python3/stdlib_module/operator/and_
- tuts/python3/stdlib_module/operator/attrgetter
- tuts/python3/stdlib_module/operator/call
- tuts/python3/stdlib_module/operator/concat
- tuts/python3/stdlib_module/operator/contains
- tuts/python3/stdlib_module/operator/countOf
- tuts/python3/stdlib_module/operator/delitem
- tuts/python3/stdlib_module/operator/eq
- tuts/python3/stdlib_module/operator/floordiv
- tuts/python3/stdlib_module/operator/ge
- tuts/python3/stdlib_module/operator/getitem
- tuts/python3/stdlib_module/operator/gt
- tuts/python3/stdlib_module/operator/iadd
- tuts/python3/stdlib_module/operator/iand
- tuts/python3/stdlib_module/operator/iconcat
- tuts/python3/stdlib_module/operator/ifloordiv
- tuts/python3/stdlib_module/operator/ilshift
- tuts/python3/stdlib_module/operator/imatmul
- tuts/python3/stdlib_module/operator/imod
- tuts/python3/stdlib_module/operator/imul
- tuts/python3/stdlib_module/operator/index
- tuts/python3/stdlib_module/operator/indexOf
- tuts/python3/stdlib_module/operator/inv
- tuts/python3/stdlib_module/operator/invert
- tuts/python3/stdlib_module/operator/ior
- tuts/python3/stdlib_module/operator/ipow
- tuts/python3/stdlib_module/operator/irshift
- tuts/python3/stdlib_module/operator/is_
- tuts/python3/stdlib_module/operator/is_none
- tuts/python3/stdlib_module/operator/is_not
- tuts/python3/stdlib_module/operator/is_not_none
- tuts/python3/stdlib_module/operator/isub
- tuts/python3/stdlib_module/operator/itemgetter
- tuts/python3/stdlib_module/operator/itruediv
- tuts/python3/stdlib_module/operator/ixor
- tuts/python3/stdlib_module/operator/methodcaller
Related notes
- tuts/python3/stdlib_module/operator/abs 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/call 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/concat links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/contains links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/countOf links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/delitem links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/eq links to this page; shared tags: #operator, #stdlib