class_docstr: Class for ultra-simple inline parallelization on multi-core CPUs
  
  Example::
  
      ## Here is the serial (single-process) task:
      
      tasks = [1, 2, 4, 8]
      results = []
      for task in tasks:
          result = processTask(task)
          results.append(result)
      print(results)
      
      
      ## Here is the parallelized version:
      
      tasks = [1, 2, 4, 8]
      results = []
      with Parallelize(tasks, workers=4, results=results) as tasker:
          for task in tasker:
              result = processTask(task)
              tasker.results.append(result)
      print(results)
      
      
  The only major caveat is that *result* in the example above must be picklable,
  since it is automatically sent via pipe back to the parent process.
class_docstr_tok: ["Class","for","ultra-simple","inline","parallelization","on","multi-core","CPUs","Example",":",":","#","#","Here","is","the","serial","(","single-process",")","task",":","tasks","=","[","1",",","2",",","4",",","8","]","results","=","[","]","for","task","in","tasks",":","result","=","processTask","(","task",")","results.append","(","result",")","print","(","results",")","#","#","Here","is","the","parallelized","version",":","tasks","=","[","1",",","2",",","4",",","8","]","results","=","[","]","with","Parallelize","(","tasks",",","workers=4",",","results=results",")","as","tasker",":","for","task","in","tasker",":","result","=","processTask","(","task",")","tasker.results.append","(","result",")","print","(","results",")","The","only","major","caveat","is","that","*","result","*","in","the","example","above","must","be","picklable",",","since","it","is","automatically","sent","via","pipe","back","to","the","parent","process","."]
code: def __enter__(self):
      self.proc = None
      if self.workers == 1:
          return self.runSerial()
      else:
          return self.runParallel()
  
imports: import multiprocessing
  import os
  import re
  import sys
  import time
  from .processes import ForkedProcess
  from .remoteproxy import ClosedError
label_desc: Use image node_id 2 for calling the Parallelize obj's underlying member method code with example usage: obj.__enter__() and returns: self, self