How to access the type arguments of typing.Generic? : <p>The <a href="https://docs.python.org/3/library/typing.html" rel="noreferrer"><code>typing</code></a> module provides a base class for generic type hints: The <a href="https://docs.python.org/3/library/typing.html#typing.Generic" rel="noreferrer"><code>typing.Generic</code></a> class.</p>

<p>Subclasses of <code>Generic</code> accept type arguments in square brackets, for example:</p>

<pre><code>list_of_ints = typing.List[int]
str_to_bool_dict = typing.Dict[str, bool]
</code></pre>

<hr>

<p>My question is, how can I access these type arguments?</p>

<p>That is, given <code>str_to_bool_dict</code> as input, how can I get <code>str</code> and <code>bool</code> as output?</p>

<p>Basically I'm looking for a function such that</p>

<pre><code>&gt;&gt;&gt; magic_function(str_to_bool_dict)
(&lt;class 'str'&gt;, &lt;class 'bool'&gt;)
</code></pre>
