[Python-ideas] Python execution progress counter

Andrew Barnert abarnert at yahoo.com
Sun Jun 23 20:38:33 CEST 2013


On Jun 23, 2013, at 9:49, anatoly techtonik <techtonik at gmail.com> wrote:

> In x86 assembly there is a concept of instruction pointer (IP) that indicates where a computer is in its program sequence (c) http://en.wikipedia.org/wiki/Program_counter
> 
> 
> I wonder if it is possible to implement a similar thing in Python? Not the instruction pointer, which points to the linear memory address space (and therefore is a 1D structure), but a 2D Execution Progress Counter, which counts position in program sequence for every stack level?

If I understand what you're asking here, the position for every stack level is just the return pointers on the stack.

So, are you asking for sys._getframe to be changed from CPython implementation detail to part of the language?

Also, what do you want this for? Are you unhappy with the debugger, or tracebacks, or with how hard it is to build alternatives to them? Looking to do something like generator suspension in a regular function? Hoping to suspend and save interpreter state to resume later, like some Smalltalk and Lisp interpreters?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130623/dab62112/attachment-0001.html>


More information about the Python-ideas mailing list