On Tue, Jun 25, 2019 at 3:01 AM James Lu <jam...@gmail.com> 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

Can you find some non-toy examples where this forked condition is
actually better than simply using a boolean operator?

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LCTBWDA4NFF4O66G2FY5EI5MJFVQBGDA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to