<div class="gmail_quote">On Fri, Feb 20, 2009 at 5:27 PM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>></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>
> If you import pickle and call pickle.A() you will get -13 which is not<br>
> what you are after.<br>
<br>
</div>Ah, you may want to think about that a bit more. There's a reason<br>
globals are looked up when they're used rather than when their function<br>
is defined. Even in your own example, _B isn't defined at all when you<br>
define A.<br>
</blockquote></div><br>No, I'm afraid Brett is quite right. Globals are looked up when the function is executed, true, but they are looked up within the module that defined the function. 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>