Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created December 21, 2011 04:00
Show Gist options
  • Save podhmo/1504506 to your computer and use it in GitHub Desktop.
Save podhmo/1504506 to your computer and use it in GitHub Desktop.
flatten
def flatten(xs):
for x in xs:
if hasattr(x, "__iter__"):
yield from flatten(x)
else:
yield x
@podhmo
Copy link
Author

podhmo commented Dec 21, 2011

pep380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment