[Tutor] (no subject)

anil maran anilmrn at yahoo.com
Fri Aug 18 10:24:21 CEST 2006


it is amazing the amount of knowledge that is being
disseminated on this group, guido should love it that
u guys are doing such a good job, keep it up guys
anil

--- Kent Johnson <kent37 at tds.net> wrote:

> Amadeo Bellotti wrote:
> > hello is there a way if a condition is not met to
> restart the whole 
> > program? for example if and if statement returns
> true then re start 
> > the whole program?
> 
> You can probably achieve what you want just by
> structuring the program 
> correctly. My guess you need to use nested loops,
> something like this:
> 
> while True:
>   initialize_everything()
>   while True:
>     if something_is_wrong():
>       break
>     do_some_work()
> 
> This will do_some_work() until something_is_wrong(),
> then it will 
> initialize_everything() and try again.
> 
> If the test for something_is_wrong() is buried deep
> in the code you can 
> break the loop by raising an exception which you
> catch in the top-level 
> loop.
> 
> Kent
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Tutor mailing list