def pipe_wait(popens):
 popens = copy.copy(popens)
 results = ([0] * len(popens))
 while popens:
  last = popens.pop((-1))
  results[len(popens)] = last.wait()
 return results

def pipe_wait ( popens ) : popens = copy . copy ( popens ) results = ( [ 0 ] * len ( popens ) ) while popens : last = popens . pop ( ( - 1 ) ) results [ len ( popens ) ] = last . wait ( ) return results
given an array of popen objects returned by the pipe method .