From python-list Fri Nov 23 17:36:15 2007 From: Sorin Schwimmer Date: Fri, 23 Nov 2007 17:36:15 +0000 To: python-list Subject: Re: Function stopping a function Message-Id: <411682.45964.qm () web56010 ! mail ! re3 ! yahoo ! com> X-MARC-Message: https://marc.info/?l=python-list&m=119584736302715 In my situation, there is a device with keyboard that allows some user input. In the same time, the device is connected to a standard PC, and there may be some communication there. The lengthy_function() resides and executes in the device, and so is cancel(). Lengthy_function() is pretty linear: according to some conditions, the user is asked for this or that. Than, with the new conditions, lenghty_function() may need to communicate with the PC. And now, with the updated conditions, may ask more stuff from user. At any time the user can press a CANCEL button, or the PC can generate a CANCEL. What I have now is a global variable which cancel() will change and then, each "if" statement in lenghty_function() will check that variable, together with its specific condition. I was hopping that there may be a more elegant solution. No threads involved in my design (apart for what the device may have to handle events like button-press and serial communication). Thanks everyone for your answers. Regards, SxN ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs -- http://mail.python.org/mailman/listinfo/python-list