[Tutor] Use flag to exit?

Eike Welk eike.welk at gmx.net
Thu Jun 24 13:55:38 CEST 2010


On Thursday June 24 2010 12:51:26 Richard D. Moores wrote:
> On Thu, Jun 24, 2010 at 03:36, Eike Welk <eike.welk at gmx.net> wrote:
> > On Thursday June 24 2010 12:15:25 Richard D. Moores wrote:
> >> OK. See <http://tutoree7.pastebin.com/v4T98iRL>. What now?
> >
> > Ah... my bad. Line 8 must be changed to:
> >        self.big_p = big_p
> 
> Yes! Perfect! Now, Eike, if I only understand what you wrote. You
> kindly included an appropriate link to the docs, but...
> 
> How about using sys.exit() instead?
From looking at the documentation I think that sys.exit(0) should exit 
cleanly.


Looking at my solution now, I think it is too complicated for your relatively 
simple use-case. I think a better solution would be to put the nested for 
loops into a function and use return to exit the computation. 

I wrote a new untested version here:
http://tutoree7.pastebin.com/RL3b2bx6


Eike.


More information about the Tutor mailing list