Re: Designing a cancellable function

2006-12-16 Thread Giovanni Bajo
Gabriel Genellina wrote: >> I now would also like to add the possibility to allow the user to >> *cancel* the execution of foo() during the processing, and I am >> wondering what the best / most Pythonic way to design this is. > > I can't say if this is the "best/more Pythonic way", but a simple

Re: Designing a cancellable function

2006-12-15 Thread Gabriel Genellina
At Friday 15/12/2006 22:20, Leo Breebaart wrote: I have written a function foo() that iterates over and processes a large number of files. The function should be available to the user as library function, via a command-line interface, and through a GUI. So, I added a 'config' object as a parame

Re: Designing a cancellable function

2006-12-15 Thread Michele
Hi Leo, what about one (or more) thread(s) which run the eat() method of FilesEater object with inheriths from a superclass what's needed to update the progress attribute (for example a _inc_progress() private method)? (So you can have a UrlEater class and so on, them all knowing how to update the

Designing a cancellable function

2006-12-15 Thread Leo Breebaart
I have written a function foo() that iterates over and processes a large number of files. The function should be available to the user as library function, via a command-line interface, and through a GUI. So, I added a 'config' object as a parameter to foo() that can be used by the caller to expli