On Wed, 9 Jan 2008 09:49:29 -0800, "Curt Hagenlocher" <[EMAIL PROTECTED]> wrote:
On Jan 9, 2008 9:42 AM, Lee Culver <[EMAIL PROTECTED]> 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.

This is an important point, and I still don't think you have it exactly right. When you say "including changes made by a reload", that really should say "ONLY IF the module has been reloaded". Unless you reload it, the "mymod" that is in the module cache will never change, and therefore SomeFunc will always get the same version of myfunc().

--
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to