Skip to content

Instantly share code, notes, and snippets.

@lsloan
Created July 29, 2016 21:40
Show Gist options
  • Select an option

  • Save lsloan/a02c3fc2cca87a23eabec248e57b7a35 to your computer and use it in GitHub Desktop.

Select an option

Save lsloan/a02c3fc2cca87a23eabec248e57b7a35 to your computer and use it in GitHub Desktop.
While working on making an efficient way of getting the course ID if its list of outcomes includes an outcome with a specific ID, I came up with these monstrosities. In the end, they DO make a list that contains one item if there is a match. However, the one item is the outcome object itself, not the course ID. Maybe a little more clever code an…
x2 = list(itertools.ifilterfalse(lambda x: courseID if x.outcome.id != verifiedOutcome.id else False,
courseOutcomesJSONObjects)) # would yield help?
x2 = list(itertools.ifilterfalse(lambda x: x.outcome.id != verifiedOutcome.id,
courseOutcomesJSONObjects))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment