def fsplit(pred, objs):
 t = []
 f = []
 for obj in objs:
  if pred(obj):
   t.append(obj)
  else:
   f.append(obj)
 return (t, f)

def fsplit ( pred , objs ) : t = [ ] f = [ ] for obj in objs : if pred ( obj ) : t . append ( obj ) else : f . append ( obj ) return ( t , f )
split a list into two classes according to the predicate .