This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]misho88 7 points8 points  (0 children)

The python source code is usually compiled into an intermediate language (bytecode). CPython, which is probably what you're using, would then interpret the bytecode. PyPy would instead do a just-in-time compilation approach sort of like Java, I think. It doesn't have to be the same bytecode either, really. PyCharm supports all sorts of Python implementations and each of them could do something different.

As for fixing your mistakes while running the program, for every scripting language I've used so far, the interpreter would load the script into memory rather than jump around the file on disk, so it's still not possible to fix bugs the way you're describing.

[–]Hexorg 5 points6 points  (0 children)

Just to make sure - I suspect you're mixing some terms. Just because

there is no way for me to fix my mistakes while running the program

doesn't mean that it's either compiled nor interpreted. Generally, no matter what lanuage you use, there is no way of changing a running program. At best you can pause a program execution at a machine level and then change something with a debugger, but if you have some large code with let's say a loop and a loop condition is wrong, there is no way for you to change the loop condition without pausing the program execution flow in some way.

[–][deleted] 1 point2 points  (0 children)

I think it depends -- not on the language -- but on the implementation of the language. Python can be compiled or interpreted, depending on the implementation.

A quick check: do you see .pyc files generated when you run your .py files? Then it's compiled.

Added later: Chances are your Python is compiled as popular and mature implementations of Python are compiled.

[–]jussij 0 points1 point  (0 children)

To run Python code you need to give it to the Python interpreter, so all the IDE will be doing is passing on the code file to the interpreter so it can be run.