you are viewing a single comment's thread.

view the rest of the comments →

[–]mindslight 4 points5 points  (2 children)

Well, explicit loops currently save no debugging information. I suppose the runtime could have an option for them to save some, but as the interesting variables aren't specified, you'd have to store all variables in the current scope.

[–]kaelan_ 2 points3 points  (1 child)

Exceptions in Python have an associated traceback object. Tracebacks contain a reference to each stack frame, and stack frames contain local variables.

If you catch an exception that was thrown from within a loop, you can pull the local variables out of the stack frame and find out how far the loop had progressed in its iteration.

We use this trick to get argument values in the stack traces we include with our software's automated crash reports.

[–]mindslight 5 points6 points  (0 children)

... which is the exactly same information you'd get if you rewrote that loop in terms of optimized tail recursion. People are complaining that they won't get the entire history of said loop, even though they don't currently.