Re: [Tutor] Stack unwind using exceptions.

2009-07-05 Thread Eike Welk
On Sunday 05 July 2009, Noufal Ibrahim wrote: > Kent Johnson wrote: > [..] > > > Why not just return the value from the function and pass it up > > the call chain? If a call fails return None. Something like this: > > That's what I ended up doing but the first thing occurred to me and > I was just

Re: [Tutor] Stack unwind using exceptions.

2009-07-05 Thread bob gailer
Noufal Ibrahim wrote: Kent Johnson wrote: [..] Why not just return the value from the function and pass it up the call chain? If a call fails return None. Something like this: That's what I ended up doing but the first thing occurred to me and I was just wondering if there's any production co

Re: [Tutor] Stack unwind using exceptions.

2009-07-05 Thread Noufal Ibrahim
Kent Johnson wrote: [..] Why not just return the value from the function and pass it up the call chain? If a call fails return None. Something like this: That's what I ended up doing but the first thing occurred to me and I was just wondering if there's any production code that relies on the

Re: [Tutor] Stack unwind using exceptions.

2009-07-04 Thread Kent Johnson
On Sat, Jul 4, 2009 at 3:56 PM, Noufal Ibrahim wrote: > Hello everyone, > > Would it be considered unorthodox or 'wrong' in some sense for me to use an > exception to unwind the stack and return to a caller for a recursive > function? > > I need to do a depth first search and when I find the right

[Tutor] Stack unwind using exceptions.

2009-07-04 Thread Noufal Ibrahim
Hello everyone, Would it be considered unorthodox or 'wrong' in some sense for me to use an exception to unwind the stack and return to a caller for a recursive function? I need to do a depth first search and when I find the right element to just stop the whole thing, and get back to the cal