Array class remove and remove_at interfaces

This page explains the Array class remove and remove_at method interfaces.

What interfaces are these?

The remove method removes a specified value from an array, and the remove_at method removes a specified index value.

Basic usage

The remove method requires target value at the first argument, as follows:

import apysc as ap

ap.Stage()
arr: ap.Array[int] = ap.Array([1, 2, 3])
arr.remove(value=2)
assert arr == [1, 3]

The remove_at method requires index (int or Int value) at the first argument, as follows:

import apysc as ap

ap.Stage()
arr: ap.Array[int] = ap.Array([1, 2, 3])
arr.remove_at(index=1)
assert arr == [1, 3]

remove API

Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.

[Interface signature] remove(self, value: ~_ArrValue) -> None


[Interface summary]

Remove a specified value from this array.


[Parameters]

  • value: Any

    • Value to remove.


[Examples]

>>> import apysc as ap
>>> _ = ap.Stage()
>>> arr: ap.Array = ap.Array([1, 3, 5])
>>> arr.remove(3)
>>> arr
Array([1, 5])

remove_at API

Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.

[Interface signature] remove_at(self, index: Union[int, apysc._type.int.Int]) -> None


[Interface summary]

Remove a specified index value from this array.


[Parameters]

  • index: Int or int

    • Index to remove value.


[Examples]

>>> import apysc as ap
>>> _ = ap.Stage()
>>> arr: ap.Array = ap.Array([1, 2, 3])
>>> arr.remove_at(1)
>>> arr
Array([1, 3])