[Tutor] cartesian product recursive loop
Gabriel Farrell
gsf at panix.com
Tue Jul 18 23:51:16 CEST 2006
On Tue, Jul 18, 2006 at 01:33:27PM -0400, Kent Johnson wrote:
> Each call to rloop() has its own local variables and its own state.
> Returning from one call doesn't pop all the way up the stack, it
> resumes execution at the point of call with the local state restored
> to what it was before the call.
Okay, this was the main abstraction I was missing, and you've spelled
it out clearly. It seems like such an "intelligent" way to handle the
flow -- I think that's what threw me off.
> It might help to put in some print statements to help you track the
> flow, or run the program in a debugger and step through it.
I *think* I get it. I read
http://www.ferg.org/papers/debugging_in_python.html , imported pdb,
and inserted pdb.set_trace() after
def rloop(seqin, listout, comb):
I'm seeing now, by stepping through the program, how it flows. Pdb is
pretty awesome! I had a feeling there was something like different
levels of loops going on, but I didn't get it before.
Thanks, Kent!
gsf
More information about the Tutor
mailing list