Is there a more concise way to split a list into two lists by a predicate?
errors, okays = [], []
for r in results:
if success_condition(r):
okays.append(r)
else:
errors.append(r)
I understand that this can be turned into an ugly one-liner using reduce
; this is not what I'm looking for.
Update: calculating success_condition
only once per element is desirable.