Flattening a list in Python. #python
def flatten(coll): for i in coll: if isinstance(i, (list, tuple)): for j in flatten(i): yield j else: yield i