Operator Functions

operator.neg()

Apply unary minus to the object.

Formal Syntax & Structure

python syntaxpython
operator.neg(obj, /)

Parameters & Attributes

NameTypeDescription
objobjectObject to inspect or copy.

Return Value

object

The object result described above.

Working Example

Example Snippetpython
import operatorprint(operator.neg(5))
Python Reference