Statement orders

David Murmann david.murmann at rwth-aachen.de
Sun Oct 2 15:34:51 EDT 2005


jepler at unpythonic.net wrote:
> Here's one case where it's bad to call update.
> 
> 	def perform_longrunning_calculation():
> 		time.sleep(1)
> 		app.update()
> 		time.sleep(1)
> 

would it be advisable to guard against this with something like this?

def perform_longrunning_calculation():
     if not app.busy:
         app.busy = 1
         time.sleep(1)
         app.update()
         time.sleep(1)
         app.busy = 0

or does this have flaws i'm not seeing?

David.



More information about the Python-list mailing list