type hinting within a class
<pre><code>class Node:
    def append_child(self, node: Node):
       if node != None:
        self.first_child = node
    self.child_nodes += [node]
</code></pre>

<p>How do I do <code>node: Node</code>? Because when I run it, it says <code>name 'Node' is not defined</code>. </p>

<p>Should I just remove the <code>: Node</code> and instance check it inside the function?
But then how could I access <code>node</code>'s properties (which I would expect to be instance of <code>Node</code> class)?</p>

<p>I don't know how implement type casting in Python, BTW.</p>