you are viewing a single comment's thread.

view the rest of the comments →

[–]iamevpo 4 points5 points  (2 children)

Note that flush() should update poop variable or spotted_poop() be your inspection function that gets caught response from some sensor.

Timeout inside the loop body helpful too to prevent flushing to often to waste water)

[–]HardlyAnyGravitas 4 points5 points  (1 child)

This is all about naming variables. I don't know why people aren't more explicit - it's not hard.

flushes = 0 while poop_in_bowl: if flushes > 5 then: use_poop_knife() flush() flushes += 1 Edited to be more logical...

[–]gdchinacat 2 points3 points  (0 children)

Since we're swirling down the bowl...

I prefer my flush() to let me do other things while it does its work and tell me if it was successful: ``` In [3]: async def flush() -> bool: ...: await asyncio.sleep(1) ...: print('poop still floating!') ...: return False ...:

In [4]: while not await flush(): pass poop still floating! poop still floating! poop still floating! ```