[IronPython] Clearing context

Curt Hagenlocher curt at hagenlocher.org
Wed Jan 9 18:49:29 CET 2008


On Jan 9, 2008 9:42 AM, Lee Culver <leculver at microsoft.com> wrote:
>
>> class MyClass(SomeNameSpace.IMyInterface):
>>     def SomeFunc(self):
>>         from mymod import myfunc
>>         myfunc()
>>
>> That way, the import gets re-run each time you run SomeFunc, and
>> you'll always get the latest version of the module.
>
> This will not re-import mymod every time the function is run.  Once you
> run "from foo import bar" or "import foo" then the "foo" module is loaded
> into python and will not be reloaded from python without an explicit call
> to the reload function.

Poor wording on my part, sorry. What I should have said was that the
"myfunc" symbol will be reimported from the "mymod" module at that
point in time, and will therefore pick up any changes to "mymod" that
have been made -- including changes made by a reload.  I did not mean
to imply that "mymod" itself would be reloaded.

--
Curt Hagenlocher
curt at hagenlocher.org



More information about the Ironpython-users mailing list