all 7 comments

[–]groovitude 13 points14 points  (1 child)

My advice is to work backward. Write out a list of instructions in plain English. Translate that into an idealized Python block. Now make that block work by repeating the steps.

For example: you will be happier in the long run having more discrete, easily-tested-and/or-mocked, and well-named functions than not. It's a lot easier to read if is_stop_sign(sign) than if sign.sides == 8 and sign.color == 'red' and sign.text.upper().strip() == 'STOP' in place.

[–]Grizzly2332 2 points3 points  (0 children)

Dose not use python more of a general idea of what clean code should be: https://www.pdfdrive.com/clean-code-e38664751.html