Guest User

Untitled

a guest
Jan 19th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. class LLN:
  2. def __init__(self, val=None, *subnodes):
  3. self._subnodes = list(subnodes)
  4. self.val = val
  5.  
  6. def append(val):
  7. subnode = LLN(val)
  8. self._subnodes.append(subnode)
  9. return subnode
  10.  
  11. def get():
  12. """depth-first recursive get"""
  13. ret = []
  14.  
  15. for val in self.val:
  16. if isinstance(val, LLN):
  17. ret.extend(val.getDF())
  18. else:
  19. ret.append(val)
  20.  
  21. return ret
Add Comment
Please, Sign In to add comment