This module provides class NList, a multidimensional list.
Indexes and shapes used with NList must be tuples. Example:
l = nlist.NList(shape=(2, 3))
l[1, 2] = 42
NList’s shape can be an empty tuple meaning a zero-dimensional list that has one element with index ().
NList converts to False only if its size is 0, meaning that at least one of its dimensions is 0. Note that the size of a zero-dimensional NList is 1.
An NList equals another NList if their shapes and all their elements are equal.
NList is an iterable of all its elements.
Whenever an ordering of indexes is implied, standard tuple comparison semantics are used.
Initialize NList either from another multidimensional structure or by shape and default value.
Parameters: |
|
---|
other and shape/default arguments are mutually exclusive
Returns a shallow copy of the NList.
Return type: | NList |
---|
Returns the number of occurrences of value in the NList.
Return type: | int |
---|
Return an iterable of all pairs (index, value) in the NList.
Returns index of the first occurrence of value in the NList.
Parameters: |
|
---|---|
Raises ValueError: | |
If the value is not found. |
|
Return type: | tuple |
start and stop must be valid indexes for the NList, or None.
Returns an iterable of all indexes valid for the NList.
Parameters: |
|
---|
start and stop must be valid indexes for the NList, or None.
Number of the NList’s dimensions. Read-only.
A tuple with the NList’s dimensions. Read-only.
Number of elements in the NList. Read-only.