[Tutor] reloading all modules?
Wed Apr 30 05:06:02 2003
At 21:56 2003-04-29 -0500, Don Arnold wrote:
>What I've done before instead of using a plain vanilla import in my modules
>is wrapping the reload in a try block and importing on the exception:
> import mymodule
In my opinion this is not an ideal solution.
First of all, every import in every module you work with
will have this awkward fourliner for every module you
That will make "import os, sys, time, string" into 16
lines of code. :(
Secondly, I think you will eventually run in to situations
where you would need to get fresh reloads also of moduls you
didn't write. There might be code which is run in import to
set things up in a module loaded by a third party module you
The more I work with python (and computers in general), the
more I appreciate working with a good commad line prompt or
shell. The old DOS shell command.com used in Windows 98 and
Me is crappy, but the shell in W2k / XP, cmd.exe, isn't too
bad if you enable autocomplete (a registry setting). (I think
it's not written by Microsoft, but aquired from a company that
made Windows emulators for Unix and Mac).
Unix shells like bash are even better, and freely available for
all recent Windows versions.
Also, in Windows, he seqence
Ctrl-S, Alt-Tab, ArrowUp, Enter
is certainly fast enough. It's not quite as fast as Ctrl-S, F5,
but certainly much faster than the mouse-waving most command
line challenged people tend to use. ;)
It's always faster if the program you actually want to run
is not a program you are currently editing. At least with the
current state of IDLE and similar competitors.
I'm open for the concepts of IDEs, but I don't think they are
good enough to skip the command line today, even if they have
their string points. For instance, a graphical debugger or
class browser is often better than any command line counter part.
With unit tests and python, the use for a debugger is fairly
Beyond that, using the command line give access to a wide array
of powerful tools, like the cygwin tools with just a few key-
presses--often just a few ArrowUp followed by Enter.
The Unix tool "grep" from the command line is much more effective
than any GUI search tool I've ever seen. Add "find" to the mix
and it's eons away.
Finally, the unix tool chain, which is now available on almost
all computers, is as useful regardless of whether you are
programming Python or doing other productive things like working
with web sites, producing documentation or what ever.
Magnus Lycka (It's really Lyckå), firstname.lastname@example.org
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The shortest path from thought to working program