Package fast_grid

Contains 2D Grid containers that supports useful iterators. More...


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.


Detailed Description

Contains 2D Grid containers that supports useful iterators.

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]
does not correctly swop two rows, but the following does:
 grid[..., 0], grid[..., 1] = grid[..., 1].clone(), grid[..., 0].clone()
Strictly speaking, it is necessary only to clone the one object, but it is hard to remember which, so it is better to clone both (?).

Todo:
Implement a way to use copy containers instead of window containers'


Function Documentation

def fast_grid.make_grid_2d (   width,
  height,
  initial_item = None 
)

Makes 2 list of lists.

Definition at line 40 of file fast_grid.py.

def fast_grid.make_grid_2d2 (   width,
  height,
  initial_item = None 
)

Makes 2 list of lists.

Definition at line 50 of file fast_grid.py.


Generated on Sun May 24 21:48:21 2009 by  doxygen 1.5.8