def pretty(e, level=0):
if len(e) > 0:
e.text = '\n' + '\t' * (level + 1)
for child in e:
pretty(child, level + 1)
child.tail = child.tail[:-1]
e.tail = '\n' + '\t' * level
This Python function uses a recursive call in its 5th line. It has a for-loop in the function with a loop variable called child
. But in its 6th line, it has a child
variable too. Please help me understand where child
was defined.