interactive development in python

Joseph Heled pepster at users.sourceforge.net
Tue Mar 11 16:45:17 EST 2003


How do I re-load imported modules?
This must be simple yet I can't find how to do it. Here is my file.

> cat d.py

def f() :
  return 1

# now I start python

> python
Python 2.2.2 (#1, Nov 29 2002, 07:18:17) 
[GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import d
>>> d.f()
1
>>> 

# now I change d.py to 'def f() : return 2'

# try re-import - does not work
>>> import d
>>> d.f()
1

# tried 'del d.f' and 'del d' to no avail.

What is the correct way? right now I have to re-start the python
interpreter every time.

-Joseph




More information about the Python-list mailing list