Imagine a python script that will take a long time to run, what will happen if I modify it while it's running? Will the result be different?
280
votes
The program is loaded into your main memory. If you change the source file, nothing happens. Imagine the CPU would read instructions from the hard drive...
- Felix Kling
@Felix: That's called "Execute-in-Place" (XIP).
- Ignacio Vazquez-Abrams
@Ignacio: Interesting, I didn't know that. Thanks :)
- Felix Kling
You may dynamically reload the code of modules, see stackoverflow.com/questions/437589/…
- Iliyan Bobev
Note that Windows batch files do execute in place, so this isn't a hypothetical question, there are languages out there that behave this way.
- yoyo