Bases: sage.structure.sage_object.SageObject
Operands wrapper for symbolic expressions.
EXAMPLES:
sage: x,y,z = var('x,y,z')
sage: e = x + x*y + z^y + 3*y*z; e
x*y + 3*y*z + x + z^y
sage: e.op[1]
3*y*z
sage: e.op[1,1]
z
sage: e.op[-1]
z^y
sage: e.op[1:]
[3*y*z, x, z^y]
sage: e.op[:2]
[x*y, 3*y*z]
sage: e.op[-2:]
[x, z^y]
sage: e.op[:-2]
[x*y, 3*y*z]
sage: e.op[-5]
Traceback (most recent call last):
...
IndexError: operand index out of range, got -5, expect between -4 and 3
sage: e.op[5]
Traceback (most recent call last):
...
IndexError: operand index out of range, got 5, expect between -4 and 3
sage: e.op[1,1,0]
Traceback (most recent call last):
...
TypeError: expressions containing only a numeric coefficient, constant or symbol have no operands
sage: e.op[:1.5]
Traceback (most recent call last):
...
TypeError: slice indices must be integers or None or have an __index__ method
sage: e.op[:2:1.5]
Traceback (most recent call last):
...
ValueError: step value must be an integer
Wrapper function to test normalize_index.
TESTS:
sage: from sage.symbolic.getitem import normalize_index_for_doctests
sage: normalize_index_for_doctests(-1, 4)
3
TESTS:
sage: from sage.symbolic.getitem import restore_op_wrapper
sage: restore_op_wrapper(x^2)
Operands of x^2