How do you develop in Python?
Louis M. Pecora
pecora at anvil.nrl.navy.mil
Fri Jun 8 08:21:32 EDT 2001
In article <3B1FCFA5.BA4AF4A0 at home.net>, Chris Barker
<chrishbarker at home.net> wrote:
> Michael Hudson wrote:
>
> This is exactly the same problem as you can get using PythonWin, and why
> I desperately wish there was a way for the IDE to NOT share the same
> interpreter as the code you are writing. Then you could just re-start
> the second interpreter.
>
> Anyway, my solution is to use:
>
> import B
> reload(B)
> # and then, of required:
> from B import *
>
> everywhere
>
> when I'm pretty confident that B is finished (maybe not untill I'm
> giving the code to someone else) I get rid of all the reloads. It's a
> little slower, but it makes sure I'm always using an up to date version
> of all my modules that are under develoment.
Chris, That I will try since it is a no-brainer -- something that
workds best for me.
> Just van Rossum wrote:
>
> > 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.
>
> This is a classic, why didn't I think of that? solution. I think I will
> still use my method for stuff I'm changing a lot, it is less likely that
> I will forget to do the refresh.
Just's solution works, but it has the problem that if you change B and
C and D depend on B and are used in A, then C and D have to be run, too
before you run A. I stumbled on that one. But it beats my stupid
solution of quiting the IDE and restarting. Talk about doing it the
hard way (see why I need a no-brainer? :-) ). I will try your
reload/from technique. Thanks.
More information about the Python-list
mailing list