Skip to content

Instantly share code, notes, and snippets.

View Jacob-Stevens-Haas's full-sized avatar
💭
🧟‍♂️

Jacob Stevens-Haas Jacob-Stevens-Haas

💭
🧟‍♂️
  • University of Washington
  • London, UK
View GitHub Profile
@Jacob-Stevens-Haas
Jacob-Stevens-Haas / unpacky.py
Created June 25, 2020 16:19
Universal Unsafe Unpacker for Python
# import random
def unsafe_unpacker(obj):
"""A generator that traverses an arbitrarily nested iterable of iterables.
Parameters:
obj (iterable): the nested iterables, e.g. a numpy array of lists of tuples
Returns:
A generator whose items are the ordered collection of any non-iterable found