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

delete(Thing,PythonObject) -- delete elements from mutable python sequences

Description

This deletes the element of x indexed by i. This is equivalent to the del keyword in Python.

i1 : x = toPython {3, 5, 7, 9}

o1 = [3, 5, 7, 9]

o1 : PythonObject of class list
i2 : delete(0, x)
i3 : x

o3 = [5, 7, 9]

o3 : PythonObject of class list
i4 : x = toPython hashTable {"spam" => 1, "eggs" => 2}

o4 = {'spam': 1, 'eggs': 2}

o4 : PythonObject of class dict
i5 : delete("eggs", x)
i6 : x

o6 = {'spam': 1}

o6 : PythonObject of class dict

Ways to use this method:


The source of this document is in Python/doc/list.m2:78:0.