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

not PythonObject -- logical negation of a python object

Description

Perform the logical negation ("not") operation on a Python object.

i1 : not toPython true

o1 = False

o1 : PythonObject of class bool
i2 : not toPython false

o2 = True

o2 : PythonObject of class bool

Unlike Macaulay2, Python supports using not with non-boolean objects. It will return False if the argument is truthy and True if it is falsy.

i3 : not toPython 0

o3 = True

o3 : PythonObject of class bool
i4 : not toPython "foo"

o4 = False

o4 : PythonObject of class bool

See also

Ways to use this method:


The source of this document is in Python/doc/logical.m2:180:0.