<p dir="ltr">I have a few thoughts:</p>
<p dir="ltr">First, how does this hypothetical system for specifying return types solve the original problem (that user-written methods on TestCase pass unexpectedly when a non-Deferred is returned)?  If I'm the one writing test_whatever, with the proposed doc string method for specifying return type, then wouldn't I need to write a docstring that specifies the return type as Deferred?</p>

<p dir="ltr">Second, I don't love the idea of the docstring changing how a function behaves... I like that it's a free form blob of text.  I think I'd rather see decorators used for this purpose.</p>
<p dir="ltr">I understand that one benefit of putting the info in the docstring is that it ensures the docstring will always be accurate.</p>
<p dir="ltr">But you could just as easily extract the return type from the decorator for generating HTML docs, and people reading the source could see the decorators.</p>
<p dir="ltr">Also, we can still leverage the existing info recorded in the docstring by doing a one time pass off the code to turn the docstring info into decorators.</p>
<p dir="ltr">My two cents</p>
<div class="gmail_quote">On Jul 25, 2013 5:13 PM, "Glyph" <<a href="mailto:glyph@twistedmatrix.com">glyph@twistedmatrix.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br><div><div>On Jul 25, 2013, at 3:51 PM, <a href="mailto:exarkun@twistedmatrix.com" target="_blank">exarkun@twistedmatrix.com</a> wrote:</div><br><blockquote type="cite"><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
On 08:33 pm,<span> </span><a href="mailto:glyph@twistedmatrix.com" target="_blank">glyph@twistedmatrix.com</a><span> </span>wrote:<br><blockquote type="cite"><br>On Jul 25, 2013, at 8:40 AM, Jonathan Lange <<a href="mailto:jml@mumak.net" target="_blank">jml@mumak.net</a>> wrote:<br>
<blockquote type="cite">On Thu, Jul 25, 2013 at 4:14 PM, Laurens Van Houtven <_@<a href="http://lvh.io" target="_blank">lvh.io</a>> wrote:<br>In addition to what jml said, I wonder if it makes sense for TestCase to raise when the return value of a test method is something other than None or a Deferred...<br>
<br><br>Why stop there? Why not have a generic system to allow specifying valid return types for any function?<br></blockquote><br>That sounds like a great idea, I wonder if anyone's thought of it before.<br><br>We already encode the information in epytext.  Should we make it a dependency, so it can be parsed at runtime to aid with enforcement?<br>
</blockquote><br>Please finish the Lore -> Sphinx transition first so that we can begin investigating whether reStructuredText for API documentation is sensible.  We don't want to drag in an epytext parsing dependency if we're just going to switch to docutils in eight or nine years.<br>
</div></blockquote></div><br><div>That's a good point, but I wouldn't want to block on it.  We could easily implement a simple abstraction layer for type identification that layers and translates between epydoc and ReST; we'd probably need this during the transitional period anyway, since lore->sphinx isn't pydoctor->sphinx.</div>
<div><br></div><div>Plus, of course, we'd need that abstraction layer to support multiple different styles of py3k function annotations, if we're talking about things that people might use in eight or nine years.</div>
<div><br></div><div>-glyph</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>