📜  python 生成器 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:46.496000             🧑  作者: Mango

代码示例4
# A recursive generator that generates Tree leaves in in-order.
def inorder(t):
    if t:
        for x in inorder(t.left):
            yield x

        yield t.label

        for x in inorder(t.right):
            yield x