autoqasm.operators.slices module
Operators for slices.
- class autoqasm.operators.slices.GetItemOpts(element_dtype)[source]
Bases:
GetItemOptsCreate new instance of GetItemOpts(element_dtype,)
- autoqasm.operators.slices.get_item(target: Any, i: Any, opts: GetItemOpts) Any[source]
The slice read operator (i.e. __getitem__).
- Parameters:
target (Any) – An entity that supports getitem semantics.
i (Any) – Index to read from.
opts (GetItemOpts) – A GetItemOpts object.
- Returns:
Any – The read element.
- autoqasm.operators.slices.set_item(target: Any, i: Any, x: Any) Any[source]
The slice write operator (i.e. __setitem__).
Note: it is unspecified whether target will be mutated or not. In general, if target is mutable (like Python lists), it will be mutated.
- Parameters:
target (Any) – An entity that supports setitem semantics.
i (Any) – Index to modify.
x (Any) – The new element value.
- Returns:
Any – Same as target, after the update was performed.