Check apply condition only if non None in Python

116 Views Asked by At

I want date either be condition or be None and make condition true. So I wrote

if (self.StartDate is None) or (d >= self.StartDate):

But PyCharm checker swears:

Expected type 'date', got 'None' instead

Why and how to succeed?

UPDATE

d is date of current enumerated item; if self.StartDate is None, then all d-s should processed, and if self.StartDate contains date, it should cut all earlier d-s

0

There are 0 best solutions below