From c8d412acbdb5cd25d571185b1425d860ffb82c96 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Tue, 25 Jun 2013 03:40:41 +0200 Subject: [PATCH] def exists ? U know, any is implemented in python -_- --- today.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/today.py b/today.py index c08f8e6..4522d07 100755 --- a/today.py +++ b/today.py @@ -110,13 +110,6 @@ def get_timers(): timers = add_title(u"Timers", timers) return timers -def exists(l): - """Renvoie True si au moins un élément de l est vrai""" - for i in l: - if i: - return True - return False - def get_birthdays(*search): """Obtenir la liste des anniversaires à venir, ou la liste des anniversaires correspondants à une recherche""" @@ -143,7 +136,7 @@ def get_birthdays(*search): search = [i.lower() for i in search] tous = ("--all" in search) for date, nom in liste: - if tous or exists([term.lower() in nom.lower() for term in search]): + if tous or any([term.lower() in nom.lower() for term in search]): thisyeardate = datetime.datetime(now.year, date.month, date.day) delta = thisyeardate - now + datetime.timedelta(1) age = now.year - date.year @@ -194,7 +187,7 @@ def get_saints(): for day in ["today", "tomorrow"]: ssaints = saints[day] for (sexe, saint) in ssaints: - if exists([firstname.lower() in saint.lower().split() for firstname in firstnames]): + if any([firstname.lower() in saint.lower().split() for firstname in firstnames]): towish[day].append(sexe + saint) ttowish = [] if towish["today"]: -- 2.39.2