__iter__ yield

2008-03-09 Thread duccio
Hello! Someone knows if it's possible to make this __iter__ function with just one 'yield' intead of two? Is there some simpler way to make this __iter__ iter through all nodes? Thanks! class Node: def __init__(self, data=None): self.childs=[] self.data=data def app

del class with recursive list

2008-03-08 Thread duccio
Hello! Will someone have time to tell me why this code don't work as I expect? And what should I do to make the "del n" delete all the lower nodes? Thanks! class Node: def __init__(self): self.childs=[] def appendNode(self, n): self.childs.append(n) def __del__(s