I have these two statements
return self.getData() if self.getData() else ''
and
return self.getData() or ''
I want to know are they same or there is any difference
I would say No because if self.getData()
changes something during its operation, then the first statement has the possibility of returning a different result since it will make a 2nd call to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With