Мой мозг, должно быть, не работает. Я хочу получить всех детей / внуков / et c из дерева. Есть ли лучший способ, чем следующие вложенные циклы с несколькими пропущенными строками кода?
def get_full_children(tv, selection):
for a in selection:
selection += tv.get_children(a)
for b in tv.get_children(a):
selection += tv.get_children(b)
for c in tv.get_children(b):
selection += tv.get_children(c)
for d in tv.get_children(c):
selection += tv.get_children(d)
for e in tv.get_children(d):
selection += tv.get_children(e)
for f in tv.get_children(e):
selection += tv.get_children(f)
for g in tv.get_children(f):
selection += tv.get_children(g)
for h in tv.get_children(g):
selection += tv.get_children(h)
for i in tv.get_children(h):
selection += tv.get_children(i)