Anonymous committed 201aae6

Added neat file example to imap docs.

  • Participants
  • Parent commits e8b13d2

Comments (0)

Files changed (1)


     def imap(self, function, *iterables):
         """This is the same as :func:`itertools.imap`, and has the same
         concurrency and memory behavior as :meth:`starmap`.
+        It's quite convenient for, e.g., farming out jobs from a file::
+           def worker(line):
+               return do_something(line)
+           pool = GreenPool()
+           for result in pool.imap(worker, open("filename", 'r')):
+               print result
         return self.starmap(function, itertools.izip(*iterables))