Writing a python script that dosen't hog resources
<p>I have a script which does a lot of computational work and is very resource intensive. When I am running the script (which typically takes several hours to complete), I am almost unable to use my machine, because it grinds to a halt.</p>

<p>I remember in the old days of VB programming, there was a <code>yield()</code> statement, which forced a memory hogging routine to be nice and hand over some CPU cycles to other processes.</p>

<p>My question is, is there a similar construct in Python which allows me to write scripts that play nicely with other processes on my machine?</p>

<p>Typical script below ....</p>

<pre><code># import required libs

if __name__ == '__main__':
    init()
    do_some_expensive_calcs()  # need to periodically 'yield' to other processes here - how do I do it?
</code></pre>
