Commits

Anonymous committed b8b02f7

added getter, as a shortcut for gmap(itemgetter...)

Comments (0)

Files changed (1)

 import types
 from collections import MutableSet, MutableSequence, MutableMapping
 import numpy
-
+from operator import itemgetter as _itemgetter
 
 class PipelineError(Exception):
     pass
         except catch:
             pass
         
+def getter(idx, target):
+    """
+    This is such a common operation, it gets its own consumer
+    """
+    target = check(target)
+    out = target.next()
+    get = _itemgetter(idx)
+    while True:
+        out = target.send(get((yield out)))
+        
         
 def pull(itr, target):
     """