Dan Yamins wrote:
What is the principle behind this? And, is there some simple
way (other than restarting the interpreter) of "reloading"
that wipes out the old attributes associated with a given name
so that spurious attributes do not remain?
No.
Conclusion: Don't use reload (ever). A dozen years of Python
programming, and I've never used it even once. If there is a
good use case for reload, you are probably years from being there.
Gary, thanks very much for your help. I suspected it was something
like this. I still can quite tell however if the problem you describe
here is the same type of issue that was behind my first problem
(posted just before) with the package imports.
I guess the think is, feel that I basically _have_ to have some way
to reload. I'm trying to code an application that allows users to
load new "mathematical operations" into a list of operations, and then
be able to update them after trying them out on some data variables
loaded into memory. If every time they change the functions in the
modules to get them to produce the right results, they have to restart
the interpreter, they'll always lose the data variables that they've
loaded and operated on. I need to find some way that they can
reload to access the modified version without having to re-do all the
command-line things they've done so far. The reload command seems
like the only (and natural) way to do this.
Thanks,
Dan
Please keep responses to python-list discussion on python-list, not my
personal mail box. -- Thanks.
I'd suggest using modules for your system's code, and exec (or execfile)
to read and parse user supplied code snippets. The result of an exec
of user supplied code will be very similar to a module import, and it
will be using import and exec as they were intended.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list