Jason Tackaberry wrote:
> On a related note, I'd like to update the yield_execution() decorator so
> that it returns an InProgress in every case.  I recently updated it to
> just return the result if the decorated function doesn't yield anything
> (rather than before where it assumed there was a next member and if
> there wasn't raised an exception), but on second thought I think this is
> a bad idea.  I think yield_execution should return an InProgress object
> no matter what, so that the caller is guaranteed to be able to connect
> to its return value.  Here we can again use the Signal.emit_deferred method.

This would remove all our 'if isinstance(returnvalue, InProgress)'
special cases since we know we always get an InProgress object. This
will make the code much simpler. But we should be carefull when using
a yield_execution inside a yield_execution in that case.

> I would also like it so that if the decorated function yields _anything_
> (including None) it is automatically continued.  I guess I never
> understood why it should be necessary to yield YieldContinue? 

Because we may want to have a return value. If I yield 42, this should
be the return value for the InProgress object.

>     @kaa.yield_execution()
>     def zap():
>        result = []
>        while do_some_work(result):
>           yield
>        yield result

OK, if we yield nothing, it could be similar to a YieldContinue. But

    @kaa.yield_execution()
    def zap():
       result = []
       if something:
          yield 3
       while do_some_work(result):
          yield
       yield result

should 'return' 3 if something is true. 


Dischi

-- 
/* After several hours of tedious analysis, the following hash
 * function won.  Do not mess with it... -DaveM
 */
        2.2.16 /usr/src/linux/fs/buffer.c

Attachment: pgpqp5EWaCzlb.pgp
Description: PGP signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to