This is just a wondering I had while reading about interpreted and compiled languages.
Ruby is no doubt an interpreted language since the source code is processed by an interpreter at the point of execution.
On the contrary C is a compiled language, as one have to compile the source code first according to the machine and then execute. This results is much faster execution.
Now coming to Python:
- A python code (somefile.py) when imported creates a file (somefile.pyc) in the same directory. Let us say the import is done in a python shell or django module. After the import I change the code a bit and execute the imported functions again to find that it is still running the old code. This suggests that *.pyc files are compiled python files similar to executable created after compilation of a C file, though I can't execute *.pyc file directly.
- When the python file (somefile.py) is executed directly ( ./somefile.py or python somefile.py ) no .pyc file is created and the code is executed as is indicating interpreted behavior.
These suggest that a python code is compiled every time it is imported in a new process to create a .pyc while it is interpreted when directly executed.
So which type of language should I consider it as? Interpreted or Compiled? And how does its efficiency compare to interpreted and compiled languages?
According to wiki's Interpreted Languages page, it is listed as a language compiled to Virtual Machine Code, what is meant by that?