Array class length interface¶
This page explains the Array
class length
property interface.
What interface is this?¶
The length
property interface returns a current array value length.
Basic usage¶
The length
property has the only getter interface. The return value type is the Int
type.
import apysc as ap
ap.Stage()
arr: ap.Array[int] = ap.Array([1, 2, 3, 4])
length: ap.Int = arr.length
assert length == 4
Notes of the len() function¶
The Array
class is not supported the Python built-in len()
function, and its function raises an exception. Please use the length
property instead.
import apysc as ap
ap.Stage()
arr: ap.Array[int] = ap.Array([1, 2, 3, 4])
len(arr)
Exception: Array instance can't apply len function. Please use length property instead.
length property API¶
Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.
[Interface summary]
Get length of this array.
[Returns]
length
: IntThis array’s length.
[Examples]
>>> import apysc as ap
>>> _ = ap.Stage()
>>> arr: ap.Array = ap.Array([1, 2, 3])
>>> arr.length
Int(3)