Macaulay2 » Documentation
Packages » Python » PythonObject » PythonObject ~
next | previous | forward | backward | up | index | toc

# PythonObject ~ -- bitwise negation of a python object

- Operator: ~
- Usage:
    `x~`
- Inputs:
  - x, a python object,
- Outputs:
  - a python object, the bitwise negation of x;

## Description

This operation negates each bit. For integers, this is equivalent to CODE "-x - 1". Unlike Python, `~` is a postfix unary operator in Macaulay2.

    i1 : (toPython 5)~

    o1 = -6

    o1 : PythonObject of class int

## See also

- PythonObject & PythonObject -- bitwise conjunction of Python objects
- PythonObject | PythonObject -- bitwise disjunction of Python objects
- PythonObject ^^ PythonObject -- bitwise exclusive disjunction of Python objects
- not PythonObject -- logical negation of a python object

## Ways to use this method:

- PythonObject ~ -- bitwise negation of a python object

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Python/doc/bitwise.m2:524:0.