<div class="gmail_quote">On Fri, Feb 20, 2009 at 5:27 PM, Nick Coghlan <span dir="ltr">&lt;<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Brett Cannon wrote:<br>
&gt; If you import pickle and call pickle.A() you will get -13 which is not<br>
&gt; what you are after.<br>
<br>
</div>Ah, you may want to think about that a bit more. There&#39;s a reason<br>
globals are looked up when they&#39;re used rather than when their function<br>
is defined. Even in your own example, _B isn&#39;t defined at all when you<br>
define A.<br>
</blockquote></div><br>No, I&#39;m afraid Brett is quite right.&nbsp; Globals are looked up when the function is executed, true, but they are looked up within the module that defined the function.&nbsp; Functions defined in _pypickle would only call the _pypickle version of functions.<br>
<blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>