Skip to content

Instantly share code, notes, and snippets.

Created September 13, 2012 17:18
What would you like to do?
def split_at_predicate(predicate, sequence):
split_sequence = list()
for item in sequence:
if predicate(item):
yield split_sequence
split_sequence = list()
yield split_sequence
Copy link

sjl commented Sep 13, 2012

Breaks on [] but otherwise yeah.

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