not logged in | [Login]

Arrays in Python - but not what you'd expect if you come from any other language.

import

import array

implemented

a=array.array(<typecode>,[intialiser])
a.append(<object_of_type_typecode>)

notes

>>> a=array.array('B',[1,2,3,4,5,6,7,8,9,10])
>>> a[0]
1
>>> a[1]
2

Only a subset of CPython typecodes are currently supported.

array.array does support the buffer protocol therefore can be used as target of pyb.ADC.read_timed or source of pyb.DAC.write_timed.

reference

CPython arrays