<div dir="ltr"><div>I&#39;m not entirely sure why you feel this is unintuitive or why you should need a workaround; in any other case, deferreds work pretty much the same way.<br><br>When reading this code, the first question that pops up in my head is: why are you doing this instead of just using the result that you already have (and assigned to a name)? How did this  waiting-twice-on-one-deferred happen?<br>

</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 28, 2013 at 8:47 AM, Sergey V. Gerasimov <span dir="ltr">&lt;<a href="mailto:sergun@gmail.com" target="_blank">sergun@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="RU"><div><p class="MsoNormal"><span lang="EN-US">It’s not intuitively clear why multiple yielding the same Defferred in function decorated with defer.inlineCallbacks get different results:<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">@defer.inlineCallbacks<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">def f():<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">                d = defer.succeed(1)<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">                result = yield d<u></u><u></u></span></p><p class="MsoNormal" style="text-indent:35.4pt">

<span lang="EN-US">print result<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">                result = yield d<u></u><u></u></span></p><p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US">print result<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Output:<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US">1<u></u><u></u></span></p><p class="MsoNormal">

<span lang="EN-US">None<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Probably we SHOULD NOT think if “d” was or was not yielded before when using inlineCallbacks..<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US">Are they some workarounds?<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>

</div></div><br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">cheers<div>lvh</div></div>
</div>