I have this code:
if self.date: # check date is not NoneType
if self.live and self.date <= now and self.date >= now:
return True
return False
My IDE says: This looks like it should be simplified i.e. Python chained comparison.
What is a chained comparison and how can it be simplified?
self.agewill never be 0? Because then the first comparison will also be false; not just withNone. - user707650self.date <= now and self.date >= nowdoesn't that just meansself.date == nowanyway? - njzk2