As a faithful follower of the Fedora Planet, today I stumbled upon a post about parallel programming in Python. Having made similar experiences myself, I would like to add another alternative for parallel programming in Python. I could have posted this in the comments of the original post, but this way the formatting is nicer.
Here is my slightly modified implementation of the same program:
#!/usr/bin/python """ Another asynchronous python example """ import multiprocessing import time def background_stuff(num): time.sleep(5) return "%s I'm done" % num if __name__ == "__main__": print "Start at:" , time.asctime(time.localtime()) pool = multiprocessing.Pool() print "Start doing something" it = pool.imap(background_stuff, [(1,), (2,)]) print "Do something..." print " ... do something else..." print it.next() print it.next() print "End at:", time.asctime(time.localtime())