Skip to content

Instantly share code, notes, and snippets.

View joelburton's full-sized avatar

Joel Burton joelburton

View GitHub Profile
@joelburton
joelburton / tree.py
Last active August 29, 2015 14:23 — forked from anonymous/file1.py
A neat idea
class Node:
def __init__(self, data, children=None):
self.data = data
self.children = children or []
def find(self, data):
for i in self.descendants():
if i.data == data:
return i
def descendants(self):
yield self