Project organization and import
bdesth.quelquechose at free.quelquepart.fr
Mon Mar 5 23:35:28 CET 2007
Martin Unsal a écrit :
> When refactoring, it's much better to move small files around than to
> move chunks of code between large files.
Indeed. But having hundreds or thousands of files each with at most a
dozen lines of effective code is certainly not an ideal. Remember that
Python let you tell much more in a few lines than some mainstream
languages I won't name here.
>>I don't reload... When my investigative tests gets bigger I write a script
>>and run it with the interpreter. It is easy since my text editor can call
>>Python on a buffer (I use Emacs).
> That's interesting, is this workflow pretty universal in the Python
I don't know, but that's also mostly how I do work.
> I guess that seems unfortunate to me,
So I guess you don't understand what Jorge is talking about.
> one of the big wins for
> interpreted languages is to make the development cycle as short and
> interactive as possible.
It's pretty short interactive. Emacs Python mode let you fire up a
subinterpreter and eval either your whole buffer or a class or def block
or even a single expression - and play with the result in the
> As I see it, the Python way should be to
> reload a file and reinvoke the class directly, not to restart the
> interpreter, load an entire package and then run a test script to set
> up your test conditions again.
^Cc^C! to start a new interpeter
^Cc^Cc to eval the whole module
Since the module takes care of "loading the entire package", you don't
have to worry about this. And since, once the script eval'd, you still
have your (interactive) interpreter opened, with all state set, you can
then explore at will. Try it by yourself. It's by far faster and easier
than trying to manually keep track of the interpreter state.
More information about the Python-list