qat.core.variables.get_item

qat.core.variables.get_item(list, index)

A Symbol allowing the extraction of an element from a list by its index. The list may contain integers, real or complex numbers, but not objects of other types.

from qat.core.variables import get_item, Variable

my_list = [1, 2.3, -3.45 + 6j]
idx_var = Variable("i")
get_item_expr = get_item(my_list, idx_var)
print(get_item_expr(i=2))
(-3.45+6j)
Parameters
  • list (list) – a list of integers, real or complex numbers

  • index (Variable or ArithExpression or number) – integer number

Returns

the list element

Return type

integer, real or complex number