<p><span class="h-card" translate="no"><a href="https://ngmx.com/@pathunstrom" class="u-url mention">@<span>pathunstrom</span></a></span> I didn&#39;t know for sure, but I know everything &quot;meta&quot; is usually stored in dunder methods, so I did this in a shell:</p><p>In [1]: def f(arg: int) -&gt; str:<br /> ...: return str(arg)<br /> ...: </p><p>In [2]: [attr for attr in dir(f) if attr.startswith(&#39;__&#39;)]<br />Out[2]: <br />[&#39;__annotations__&#39;,<br /> &#39;__builtins__&#39;,<br /> &#39;__call__&#39;,<br /> &#39;__class__&#39;,<br /> ... ]</p><p>Conveniemtly, .__annotations__ is what you&#39;re looking for:</p><p>In [3]: f.__annotations__<br />Out[3]: {&#39;arg&#39;: int, &#39;return&#39;: str}</p>
Reply