Skip to content
Vince Buffalo edited this page Aug 10, 2015 · 1 revision

Writing and Debugging While Loops

This may seem obvious, the but only way to safely write complex while loops properly (in my opinion) is to treat them like FSM. Exhausting each state in a while True loop and breaking manually out is much safer than len(some_object) as a condition. This became clear in a small, yet painful debugging experience writing a recombination backwards simulation, keeping track of ancestral segments (which kept getting lost).

Clone this wiki locally