On 2020-03-09 14:16, David Mertz wrote:
This isn't a terrible use of the walrus operator either.
if blue_20 := (color==BLUE and count==20) or red_5 := (color==RED
and count%5==0)
rotate_the_wheel() # Common to the two sub-conditions
if blue_20: # First sub-condition
set_signal()
if red_5: # Second sub-condition
clear_signal()
proc_post_rotate() # Common to the two sub-conditions
[snip]
The problem there is that if the first part of the condition is true,
the second part won't be evaluated, so red_5 won't be set.
_______________________________________________
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/BIDU4EBFLW6C3NEXW5OGF353ZDRYFCD2/
Code of Conduct: http://python.org/psf/codeofconduct/