DataStructs.LazySignature.LazySig

Package DataStructs :: Module LazySignature :: Class LazySig |
[hide private]
[frames] | no frames]

# Class LazySig

source code

Instance Methods | [hide private]
__init__(self, computeFunc, sigSize) computeFunc should take a single argument, the integer bit id... | source code
__len__(self) >>> obj = LazySig(lambda x:1,10)... | source code
__getitem__(self, which) >>> obj = LazySig(lambda x:x,10) >>> obj[1] 1 >>> obj[-1] 9 >>> try: ... | source code

Method Details | [hide private]

### __init__(self, computeFunc, sigSize) (Constructor) | source code
    computeFunc should take a single argument, the integer bit id
    to compute

### __len__(self) (Length operator) | source code
    >>> obj = LazySig(lambda x:1,10)
    >>> len(obj)
    10

### __getitem__(self, which) (Indexing operator) | source code
    >>> obj = LazySig(lambda x:x,10)
    >>> obj[1]
    1
    >>> obj[-1]
    9
    >>> try:
    ...   obj[10]
    ... except IndexError:
    ...   1
    ... else:
    ...   0
    1
    >>> try:
    ...   obj[-10]
    ... except IndexError:
    ...   1
    ... else:
    ...   0
    1