python中一个画树的函数,能解释一下是怎么运行的吗

其中p = Turtle()
def tree(plist, l, a, f):
""" plist is list of pens
l is length of branch
a is half of the angle between 2 branches
f is factor by which branch is shortened
from level to level."""
if l > 5:
lst = []
for p in plist:
p.forward(l)
q = p.clone()
p.left(a)
q.right(a)
lst.append(p)
lst.append(q)
tree(lst, l * f, a, f)

递归执行

plist is list of pens plist是pen的list
l is length of branch l是分支的长度
a is half of the angle between 2 branches a是2个分支角度的一般
f is factor by which branch is shortened f是表示哪个分支被缩减了
from level to level. 从一层到另一层

通过遍历plist列表中的元素,把列表中每一个元素复制成两个元素,定义它们的方向,存储到plist列表里。