I've written this same kind of if statement line 20 or 30 times over the last few months, and I'm seeking a more efficient way to write it:
if type(_dt) == dt.date or type(_dt) == dt.datetime:
or more generally: if x = y, or x = z:
so I thought I'd try this in the interpreter:
In: if 1 == 2 or 1:
print('yay')
Out: yay
I was hoping someone could explain to me why this worked, and if this is the right way to do an inf statement like;
if x == y or z:
Thanks!