在二叉搜索树的中序遍历中,它在代码中的哪个位置向上遍历?

In a inorder traversal of a binary search tree, where in the code does it traverse up?

我知道它是如何沿着树向下移动的,但看不到它是如何向上遍历并到达根的右侧的。有人可以解释吗?这是 Python.

中的全功能中序遍历代码
def inorder(self):
    if self:
        if self.leftChild:
            self.leftChild.inorder()
        print(str(self.value))
        if self.rightChild:
            self.rightChild.inorder()

这段代码具体在树中的哪个位置返回?

到达函数末尾与执行 return 相同,后者与执行 return None.

相同

对于没有return有意义值的函数,最好让执行到达函数的末尾,而不是在函数末尾放置一个多余的return