ezarrays Python Module Reference

 

Array Class Reference

EZ ArraysArray2D

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.

Public Methods

Array(size)
Creates a one-dimensional array with elements organized in linear order.
len(x)
Returns the length or number of elements in the array.
v = x[index]
Returns the value stored in an element of the array.
x[index] = value
Stores a new value into an element of the array.
clear()
Sets every element to None.
clear(value)
Clears the array by setting every element to None.

Detailed Description

Array(size)
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.
Parameters:
size
The number of elements in the array, which must be >= 1.
__len__: len(x)
Returns the length or number of elements in the array.
Returns:
The number of elements in the array.
clear()
Sets every element to None. All of the elements in the array will be set to None.
clear(value)
Clears the array by setting every element to None.
Parameters:
value
The value to be stored in each element of the array.
__getitem__: v = x[index]
Returns the value stored in an element of the array.
Parameters:
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.
Returns:
The value stored in the given array element.
Exceptions:
IndexError
__setitem__: x[index] = value
Stores a new value into an element of the array. The contents of the array element at position index is changed to value.
Parameters:
index
The index of the element to be changed. It must be >=0 and less than the number of elements in the array.
value
The new value to be stored in the given element.
Exceptions:
IndexError



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