PlasmaCalcs.tools.iterables.Container

class PlasmaCalcs.tools.iterables.Container(stuff)

Bases: object

a container for multiple objects, & rules for enumerating & indexing.
Here, implements self.__getitem__ so that self[i]=self.data[i],
and self.enumerate which yields (i, self[i]) pairs.
subclass should implement __init__, _enumerate_all, and new_empty.
__init__(stuff)
should set self.data = something related to stuff.

Methods

__init__(stuff)

enumerate([idx])

new_empty([fill])

size([idx])

enumerate(idx=None)
iterate through i in idx, yielding (i, self[i]) pairs.
If idx is None, iterate through all objs in self (see self._enumerate_all).
new_empty(fill=UNSET)
return a new container of the same shape as self, filled with the value fill.
The implementation will depend on the container type; subclass should implement.
size(idx=None)
return the number of objects in the container, or in idx if provided.