On this page
operator.iadd
Prev: operator.gt | Up: operator | Next: operator.iand
Rel: operator.abs, operator.add, operator.and_, operator.attrgetter
Ref: docs.python.org — operator.iadd
Tags: #public #python3 #stdlib #operator
Import
import operator
from operator import iadd
Signature & Overview
operator.iadd(a, b, /)
Same as a += b.
Usage
import operator
xs = [1, 2]
res = operator.iadd(xs, [3])
assert res is xs and xs == [1, 2, 3]
Gotchas
- Always capture the return value (
x = operator.iadd(x, y)): Immutable types likeint/tuplereturn a new object.
REPL Inspect
from operator import iadd
help(iadd)
Linked from
Related notes
- tuts/python3/stdlib_module/operator/gt Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/iand 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