Classes | |
class | PrincipleContainer |
Sub-classes of this container can be used directly. More... | |
class | Container |
Abstract super class of all grid-like containers. More... | |
class | Container2D |
Class that implements __str__ and __iter__. More... | |
class | Grid2D |
Class that represent a 2D grid, with enhanced slicing notation. More... | |
Functions | |
def | make_grid_2d |
Makes 2 list of lists. | |
def | make_grid_2d2 |
Makes 2 list of lists. |
These classes are faster than those provided in fast_grid. They do not support slicing, though.
grid1 = Grid3D(10, 10, 10, 0) grid2 = Grid3D(10, 10, 10, 1) grid1[0, 0, 0] = grid2[0, 0, 0] grid1[0, 0, 2:6:2] = grid2[0, 0, 4:5] grid1[0, 0, ...] = grid2[0, 0, ...] grid1[0, ..., 0] = grid2[..., 0, 0] grid1[..., ..., ...] = grid2[..., ...., ....]
Slicing does not copy elements - an auxiliary window container is created that delegates further operations to the underlying container. Note that assignments to slices from the same object might not behave as espected. Parallel assignment also does not always work as expected. For example:
grid[..., 0], grid[..., 1] = grid[..., 1], grid[..., 0]
grid[..., 0], grid[..., 1] = grid[..., 1].clone(), grid[..., 0].clone()
def fast_grid.make_grid_2d | ( | width, | ||
height, | ||||
initial_item = None | ||||
) |
def fast_grid.make_grid_2d2 | ( | width, | ||
height, | ||||
initial_item = None | ||||
) |