[Tutor] Edit program while executing

Mats Wichmann mats at wichmann.us
Sun Oct 3 09:38:14 EDT 2021


On 10/2/21 14:22, Julius Hamilton wrote:
> Hey,
> 
> Is there any way to edit a computer program while it is running?
> 
> For example, with Python - when the script is executed, what happens next?
> Does it get compiled into assembly language and sent to the computer’s
> circuits? In that case, if the computer allowed it, if you edited the
> program, and the computer knew where in the program it was, it might in
> theory be possible to pass the new instructions after the point where the
> execution is.

If you want gory details there are some good descriptions here:

https://tenthousandmeters.com/

You can actually "compile" new code on the fly - as has already been 
mentioned this happens on imports, and the compile() built-in function 
can be called to compile a bit of code passed as a string into a code 
object.  But there's a bit more to it than that, and doesn't really 
sound like what you are asking about.




More information about the Tutor mailing list