Daniel Stutzbach wrote: > On Fri, Feb 20, 2009 at 5:27 PM, Nick Coghlan <ncoghlan at gmail.com > <mailto:ncoghlan at gmail.com>> wrote: > > Brett Cannon wrote: > > If you import pickle and call pickle.A() you will get -13 which is not > > what you are after. > > Ah, you may want to think about that a bit more. There's a reason > globals are looked up when they're used rather than when their function > is defined. Even in your own example, _B isn't defined at all when you > define A. > > > 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. Oh, I see what you mean now. Looks like Brett's tracked substitution may be the way to go then. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia ---------------------------------------------------------------
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4