I'm reading a book about Python now, but before I learned the language, I found it interesting how Python works, so I posted it.
Is Python generally an "object-oriented scripting language"? It is classified into the category like. It seems to be somewhere between an object-oriented programming language like Java and a scripting language like Perl. The description can be done like a script language, and structurally it seems to be a language with functions like object orientation.
It seems that this language does not need to be compiled before execution like C, C ++, Java, and if the file is rewritten every time it is executed, the source code is automatically rewritten to bytecode, and that bytecode Is executed on PVM (Python Virtual Machine). Since PVM is a virtual machine that only executes bytecode from the top line to the last line in order, there is no need to rewrite it into a binary that the computer itself can understand like C language, and PVM understands and executes bytecode. Will do it. This kind of language mechanism is called an interpreter.
The advantage of the interpreter is that once you create a bytecode on any computer, it can be executed on a PVM, regardless of the language version or computer. It is versatile because it is not necessary to compile the source code for each computer and rewrite the binary by taking many steps like in C language. It's true that Java also uses an interpreter, so if you're familiar with Java, you shouldn't wonder. The disadvantage is that it doesn't rewrite the binary and runs on a virtual machine, so the speed is slower than C, but I haven't learned enough about this, so I haven't fully understood it. If anyone knows, please let me know.
Reference: First Python 3rd Edition (Publisher: O'Reilly Japan)
Recommended Posts