interactive shell -- reload definitions?

James Stroud jstroud at ucla.edu
Tue May 9 22:03:41 EDT 2006


Metalone wrote:
> I have a question about the interactive Python shell.  Is it possible
> to reload a file and get the new definitions.
> 
> For example, if I do
> import xyz
> 
> Then I find a bug in some function in xyz.
> So, I edit xyz.py
> 
> I would like to reload the definitions in xyz.py without leaving my
> current shell session.
> Is this possible?
> 
> 
> Also, is there any way to save definitions created in the interactive
> shell to a file?
> Sometimes I write a simple function in the shell, and this wish I had
> that function in an external file.
> 
> Thanks.
> 

Quoting my python interpreter:

"""
Help on built-in function reload:

reload(...)
     reload(module) -> module

     Reload the module.  The module must have been successfully imported 
before.
"""

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list