<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> An equivalent way to write this in Python 2 is the following:<br>
><br>
>     def embezzle(self, account, funds=1000000, *fake_receipts):<br>
>         # type: (str, int, *str) -> None<br>
>         """Embezzle funds from account using fake receipts."""<br>
>         <code goes here><br>
<br>
</span>By using comments, the annotations would not be available at<br>
runtime via an .__annotations__ attribute and every tool would<br>
have to implement a parser for extracting them.<br>
<br>
Wouldn't it be better and more in line with standard Python<br>
syntax to use decorators to define them ?<br>
<br>
    @typehint("(str, int, *str) -> None")<br>
<span class="">    def embezzle(self, account, funds=1000000, *fake_receipts):<br>
</span><span class="">        """Embezzle funds from account using fake receipts."""<br>
        <code goes here><br></span></blockquote><div><br></div><div>I really like MAL's variation much better.  Being able to see .__annotations__ at runtime feels like an important feature that we'd give up with the purely comment style.</div><div> </div></div><div><br></div>-- <br><div class="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons.  Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div>
</div></div>