# getitem -- get elements of python sequences

## Synopsis

• Usage:
getitem(x, y)
x_y
• Inputs:
• x, ,
• y, ,
• Outputs:

## Description

You may access elements of python sequences using getitem 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 : getitem(x, 0) o2 = 1 o2 : PythonObject of class int i3 : x_1 o3 = 2 o3 : PythonObject of class int

It also works for dictionaries.

 i4 : x = rs "{'spam':1,'eggs':2}" o4 = {'spam': 1, 'eggs': 2} o4 : PythonObject of class dict i5 : getitem(x, "spam") o5 = 1 o5 : PythonObject of class int i6 : x_"eggs" o6 = 2 o6 : PythonObject of class int

## Ways to use getitem :

• "getitem(PythonObject,Thing)"

## For the programmer

The object getitem is .