24 Jun
2019
24 Jun
'19
5:09 p.m.
On 2019-06-24 17:32, James Lu wrote:
I think
print("Remember to wear sunscreen!") if hot_outside unless Weather.is_raining()
Is more readable than
if hot_outside and not Weather.is_raining(): print("Remember to wear sunscreen!")
I think the unless syntax would be especially useful when there is a series of functions like this.
The general use case would be:
side_effecting_expression if frequent_condition unless rare_condition
Python isn't English, and I don't think we should be pushing it in that direction.