title: can self.left be recognized as a variable in pformat({f"{self.value}": (self.left, self.right)}, indent=1)?
body: <p>I use the codes below to print the structure of a tree. It do works, but I wonder in the last line how it recognize <code>self.left</code> and <code>self.right</code> as a variable rather than just a string? In my knowledge, variable should be enclosed by <code>{}</code> in f-string, but this differs.</p>
  <pre><code>class Node:
      def __init__(self, value: int, parent: Node | None) -&gt; None:
          self.value = value
          self.parent = parent
          self.right: Node | Node = None
          self.left: Node | Node = None
  
      def __repr__(self) -&gt; str:
          if self.left is None and self.right is None:
              return str(self.value)
          return pformat({f&quot;{self.value}&quot;: (self.left, self.right)}, indent=1)
  </code></pre>