On 2008-01-17 13:54, Dirk Meyer wrote:
> 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.

How about a special case: if the yield_execution()-decorated function
yields an InProgress object, rather than calling the connected handler
with this, it just post-pones execution of the function until the
InProgress completes.  If that doesn't make much sense, here's an example:

    @kaa.yield_execution()
    def foo():
       yield 42

    @kaa.yield_execution()
    def bar():
       ip = foo()
       yield ip
       result = ip.get_result()
       ... do some more stuff ...
      

Syntactically this is ugly, but we've used this idiom before.  You know,
with Python 2.5 we could do this:

    result = yield foo()
      


>> 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.
>   

Right, I forgot that InProgress objects can be called.  Well then let's
forget the idea of being able to yield multiple values.  It's still an
improvement to say that yield alone will act like YieldContinue, and
yielding a value (or raising StopIteration) will terminate the function
(i.e. its next() will not be called).


-------------------------------------------------------------------------
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