t.f.p.Filter(Pipe) : class documentation

Part of twisted.flow.pipe View Source View In Hierarchy

flow equivalent to filter: Filter(function, source, ... )

Yield those elements from a source stage for which a function returns true. If the function is None, the identity function is assumed, that is, all items yielded that are false (zero or empty) are discarded.

For example:
   def odd(val):
       if val % 2:
           return True

   def range():
       yield 1
       yield 2
       yield 3
       yield 4

   source = flow.Filter(odd,range)
   printFlow(source)
Method __init__ Undocumented
Method process process implemented by the pipe

Inherited from Pipe:

Method _yield executed during a yield statement by previous stage

Inherited from Stage (via Pipe):

Method __iter__ Undocumented
Method next return current result
def __init__(self, func, source, *trap): (source)
Undocumented
def process(self, results, stop): (source)

process implemented by the pipe

Take a set of possibly empty results and sets the member variables: results, stop, or failure appropriately
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:02:37.