Accum

class emlib.iterlib.Accum(init=0)[source]

Bases: object

Simple accumulator

Example

Iterate over seq until the sum of the items exceeds a given value

>>> seq = range(999999)
>>> takewhile((lambda item, accum=Accum(): accum(item) < 100), seq)

Methods Summary

__call__(value)

Call self as a function.

Methods Documentation

__call__(value)[source]

Call self as a function.

Return type:

TypeVar(T)