Macaulay2 » Documentation
Packages » Python :: isMember(Thing,PythonObject)
next | previous | forward | backward | up | index | toc

isMember(Thing,PythonObject) -- test membership in a python object

Synopsis

Description

This calls Python's __contains__ method, which is equivalent to using the Python in keyword.

i1 : isMember(toPython 3, toPython {1, 2, 3})

o1 = true
i2 : isMember(toPython 4, toPython {1, 2, 3})

o2 = false

Note that testing a non-Python object for membership will always return false.

i3 : isMember(3, toPython {1, 2, 3})

o3 = false

Ways to use this method: