Set defaults at runtime
<p>I manage a fairly large python-based quantum chemistry suite, <a href="http://pyquante.sf.net" rel="nofollow">PyQuante</a>. I'm currently struggling with how to set various defaults so that users can choose among different options at runtime.</p>

<p>For example, I have three different methods for computing electron repulsion integrals. Let's call them a,b,c. I used to simply pick the one I liked best (say, c), and have that hard-wired into the module that computes these integrals. </p>

<p>I have now modified this to use a module, Defaults.py, that contains all such hard-wires. But this is set at compile/install time. I would now like users to be able to override these options at runtime, say, using a .pyquanterc.py file.</p>

<p>In my integral routines, I currently have something like</p>

<pre><code>from Defaults import integral_method
</code></pre>

<p>I know about dictionaries, and the .update() method. But I don't know how I would use this in real life. My defaults module looks like</p>

<pre><code>integral_method = c
</code></pre>

<p>should I modify the end of Defaults.py to look for a .pythonrc.py file and override these values? E.g.</p>

<pre><code>if os.path.exists('$HOME/.pythonrc.py'): do_something
</code></pre>

<p>If so, what should do_something look like?</p>
