ezarrays Python Module Reference

 

Array Class Reference

EZ ArraysArray2D

<classdoc Array> <descp> Defines a true one-dimensional array with a limited number of operations similar those provided in other languages. The elements of the array, which store Python references, can be accessed using normal subscript notation, x[i]. The class is implemented using CPython's hardware array interface.

<figure img="array.jpg" size="400px"> </descp>

<method Array params="size"> <descp> Creates a one-dimensional array with elements organized in linear order. The number of elements in the array is provided as an argument and each element is initialized to None. The elements of the array are accessed by index or position with the first element having an index of 0. </descp> <param size>The number of elements in the array, which must be >= 1.</param> </method>

<method __len__ op="len(x)"> <descp> Returns the length or number of elements in the array. </descp> <returns>The number of elements in the array.</returns> </method>

<method clear> <descp> Sets every element to None. All of the elements in the array will be set to None. </descp> </method>

<method clear params="value"> <descp> Clears the array by setting every element to None. </descp> <param value>The value to be stored in each element of the array.</param> </method>

<method __getitem__ op="v = x[index]"> <descp> Returns the value stored in an element of the array. </descp> <param index> The index of the element whose value is to be returned. It must be >= 0 and less than the number of elements in the array. </param> <returns>The value stored in the given array element.</returns> <throws>IndexError</throws> </method>

<method __setitem__ op="x[index] = value"> <descp> Stores a new value into an element of the array. The contents of the array element at position index is changed to value. </descp> <param index> The index of the element to be changed. It must be >=0 and less than the number of elements in the array. </param> <param value> The new value to be stored in the given element. </param> <throws>IndexError</throws> </method>

</classdoc>

EZ ArraysArray2D
Print -- Recent Changes
Page last modified on March 06, 2013, at 04:20 PM