On this page
operator.invert
Prev: operator.inv | Up: operator | Next: operator.ior
Rel: operator.abs, operator.add, operator.and_, operator.attrgetter
Ref: docs.python.org — operator.invert
Tags: #public #python3 #stdlib #operator
Import
import operator
from operator import invert
Signature & Overview
operator.invert(a, /)
Same as ~a.
Usage
import operator
assert operator.invert(5) == -6
Gotchas
- Bitwise NOT (
~a): Not boolean negation (useoperator.not_fornot a).
REPL Inspect
from operator import invert
help(invert)
Linked from
Related notes
- tuts/python3/stdlib_module/operator/inv Linked here; links to this page; shared tags: #operator, #stdlib
- tuts/python3/stdlib_module/operator/ior 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