What is the Python equivalent of Ruby's fork block?
Question: With Ruby, a `fork` block can be used to express that

> Statements in this block are only executed in the child process and will be
> skipped over by the parent process.

Is there something similar in Python?


Answer: If you want to have some code executed in child processes, use
[`multiprocessing`](http://docs.python.org/library/multiprocessing.html)
module. Here's an example from documentation:

    
    
    from multiprocessing import Process
    
    def f(name):
        print 'hello', name
    
    if __name__ == '__main__':
        p = Process(target=f, args=('bob',))
        p.start()
        p.join()
    

This example shows how function **f** can be executed inside child process.

