How do you develop in Python?

Louis M. Pecora pecora at anvil.nrl.navy.mil
Wed Jun 6 08:17:48 EDT 2001


In article <3B1D4916.8F572A51 at letterror.com>, Just van Rossum
<just at letterror.com> wrote:

> Lou Pecora wrote:
> > 
> > I program in Python occassionally and would like to do more of it.  But
> > here's a development conundrum I run into a lot (there are more complex
> > examples, but I'll give an easy one).  I am developing module A.py
> > which imports B.py in the IDE.  I am running test code which is also in
> > A.py as I incrementally develop A.py.  Then I need to change B.py and,
> > of course, the import does not import the new changes since import only
> > works once.  Hence,  to "refresh" B.py I have to quit the IDE and
> > restart, open A.py and run.  This is clumsy.  However, the above
> > scenario is not uncommon and more complex interdependencies of modules
> > appear to make it unavoidable.  Anyone know a way to get around this
> > "import" problem?   I know there is a "reload", but then I have to
> > import and change my modules' code to "reload" or something each time I
> > work with them.  Any help appreciated.
> > 
> > I use Python on a Macintosh.  Nice IDE, otherwise.
> 
> It's simple: if you modify B.py, _run_ B.py to refresh it (*). A.py will see
> the changes. It's hardly ever neccesary to quit the MacPython IDE.
> 
> *) In other words: if B.py has already been imported, running it it will
> execute it in B's old namespace, effectively refreshing it for everybody
> to see.
> 
> Just

Hi, Just,

I see what you're saying.  That sounds like a nice easy step for
someone like me.  :-)   Thanks very much for a simple, but very useful
pointer.



More information about the Python-list mailing list