network/library: fix Util.first to properly honor predicate

This commit is contained in:
Thomas Haller 2017-03-02 18:47:39 +01:00
parent ddc1493a6f
commit b085b9be67

View file

@ -56,9 +56,8 @@ class Util:
@staticmethod
def first(iterable, default = None, pred = None):
for v in iterable:
if pred is not None and pred(v):
continue
return v
if pred is None or pred(v):
return v
return default
@staticmethod