How to make a type hint forward reference
<p>I am playing around with python's 3.5 type hints. I was wondering how can I type hint the return type of a class method.</p>

<p>This is what I had in mind:</p>

<pre><code>&gt;&gt;&gt; class A():
    @classmethod
    def a(cls) -&gt; A:
        pass

Traceback (most recent call last):
  File "&lt;pyshell#24&gt;", line 1, in &lt;module&gt;
    class A():
  File "&lt;pyshell#24&gt;", line 3, in A
    def a(cls) -&gt; A:
NameError: name 'A' is not defined
</code></pre>

<p>Clearly it does not work. I guess one way would be to do some sort of "forward declaration" like so:</p>

<pre><code>&gt;&gt;&gt; class A():
    pass

&gt;&gt;&gt; class A():
    @classmethod
    def a(cls) -&gt; A:
        pass
</code></pre>

<p>But that does not feel "pythonic". How do people normally solve this?</p>