title: Python: specify same generic argument type
body: <p>I am starting to learn Python from Java. I would like to write Python code similar to this line in Java:</p>
  
  <pre><code>public BinaryNode(T nodeData, BinaryNode&lt;T&gt; leftChild, BinaryNode&lt;T&gt; rightChild) {}
  </code></pre>
  
  <p>Here is what I have tried so far:</p>
  
  <pre><code>from typing import TypeVar
  
  T = TypeVar('T')
  class BinaryNode:
  
      def __init__(self, nodeData : T, leftChild : BinaryNode = None,
               rightChild : BinaryNode = None):
            self.nodeData = nodeData
            self.leftChild = leftChild
            self.rightChild = rightChild
  </code></pre>
  
  <p>How I should specify that the BinaryNodes passed to <code>__init__</code> should have the same type parameter as the <code>nodeData</code>? Thanks for your help.</p>