KEMBAR78
Arrays | PDF
0% found this document useful (0 votes)
40 views2 pages

Arrays

Uploaded by

Brian I. Kate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Arrays

Uploaded by

Brian I. Kate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
ft / MicroPython libraries / array - arrays of numeric data This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version, array — arrays of numeric data This module implements a subset of the corresponding CPython module, as described below. For more information, refer to the original CPython documentation: array . Supported format codes: b, 8, h, Hy i, T, 1, Ly a, 0, f, a (the latter 2 depending on the floating-point support). Classes class array.array(typecode [, iterable }) Create array with elements of given type. Initial contents of the array are given by iterable. If itis not provided, an empty array is created. append(val) Append new element val to the end of array, growing it. extend{iterable) Append new elements as contained in iterable to the end of array, growing it. _getitem__(index) Indexed read of the array, called as. afindex] (here is an array ). Returns a value if index is an int and an) array if index is a slice. Negative indices count from the end and indexérror is thrown if the index is out of range. Note: _getiten__ cannot be called directly ( 2.__getiven_(incex) fails) and is not present in _ ict, however aindex} does work. _—setitem_{index, value) Indexed write into the array, called as {index} = value (where a isan array ). value is a single value if index is an int and an array if index is a slice. Negative indices count from the end and indexerror is thrown if the index is out of range. Note: _setiten_ cannot be called directly ( 2._setiten_(index, value) fails) anc not present in _ dict, however a[index] = value does work. len_() Returns the number of items in the array, called as ien(a) (where 2 isan array ). Note: _1en__ cannot be called directly ( 2.__1en_()_ fails) and the method is not presentin _aict_ , however 1en(a) does work. —_add__(other) Return anew array that is the concatenation of the array with other, called as a + other (Where a and other are both arrays ). Note: _scd__ cannot be called directly ( 2._acd_(other) fails) and is not present in _sict__, however a + other does work. __iiadd__(other) Concatenates the array with other in-place, called as 2 + other (where a and other are both arrays ), Equivalent to exterd(other) « Note: _iada__ cannot be called directly ( 2._iace__(other) fails) and is not present in _sict__, however a == other does work. —repr_() Returns the string representation of the array, called as str(a) or repr(a)’ (where a isan array ). Returns the string “array(, [])" , where is the type code letter for the array and is a comma separated list of the elements of the array. Note: _repr__ cannot be called directly ( 2._repe_()_ fails) and is not present in _sict__, however str(a) and repr(a) both work.

You might also like