You may set elements of mutable python sequences using setitem or the shortcut _. This is equivalent to square brackets ([]) in Python. For example, this works for lists.
i1 : x = rs "[1,2,3,4]" o1 = [1, 2, 3, 4] o1 : PythonObject of class list |
i2 : setitem(x, 0, 5) |
i3 : x o3 = [5, 2, 3, 4] o3 : PythonObject of class list |
It also works for dictionaries.
i4 : x = rs "{'spam':1,'eggs':2}" o4 = {'spam': 1, 'eggs': 2} o4 : PythonObject of class dict |
i5 : x_"ham" = 3 |
i6 : x o6 = {'spam': 1, 'eggs': 2, 'ham': 3} o6 : PythonObject of class dict |
The object setitem is a method function.