On Fri, May 23, 2008 at 3:40 PM, Joel Koltner <[EMAIL PROTECTED]>
wrote:

> How do I get Python to correctly re-load this function definition?
>
> In test.py:
>
> def testFunc():
>    print 'My testFunc!'
>
> I execute...
>
> >>> from test import testFunc
> >>> testFunc()
> My testFunc!
>
> Fine... now I change test.py to:
>
> def testFunc():
>    print 'Modified testFunc!'
>
> ...and I'd like to reload testFunc.  How do I do so?  'from test import
> testFunc' keeps the old definition around, and 'reload test' of course
> doesn't
> work becayse I didn't use 'import test' in the first place.
>

"Namespaces are one honking great idea -- let's do more of those!"

If you don't want to have to type out the full name every time just do
"import test as t". That makes it only 2 extra characters to type. If you
don't put everything in the same namespace, you don't have to worry about
clashing.

>
> Thanks for the help,
> ---Joel
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to