Lately I've been tinkering around with Erlang and have begun to sorely want some of its features in Python, mostly the ease at which new processes can be forked off for computation. To that end I've coded up a class I call, boringly enough, Process. It takes a function, its args and keywords and runs the function in another process using os.fork. Processes can be treated as callables to retrieve the return value of the passed in function.
The code is pasted here: http://deadbeefbabe.org/paste/4972. A simple exposition of Process is included at the end of the code in some __main__ magic. (Note: The code will not run on any system which lacks os.fork and spawns 100 child processes while running.) I'd very much appreciate people to look the code over and give me their reactions to it, or suggests for improvement. As it stands, I see three major defects with the current implementation: 1) Process hangs forever if its child errors out. 2) Process isn't portable because of its use of os.fork(). 3) Process should use AF_UNIX when available instead of TCP. --- blt -- http://mail.python.org/mailman/listinfo/python-list