I think you're right and we could do this, but we would be trading performance for simplicity, so this might fall under "premature optimization".
To avoid the "copying totals to a list" step, you'd have to write more code to replace the "accumulate" call in line 288.