+ 2

What is byte code?

9th May 2019, 11:14 AM
Vlad Rodikov
Vlad Rodikov - avatar
3 Answers
+ 8
Python, like many interpreted languages, actually compiles source code to a set of instructions for a virtual machine, and the Python interpreter is an implementation of that virtual machine. This intermediate format is called "bytecode." https://opensource.com/article/18/4/introduction-python-bytecode
9th May 2019, 11:33 AM
Thoq!
Thoq! - avatar
+ 1
A "Byte code" is an intermediate code generated by the compiler. This code is not in binary and hence it is not dependent on any machine on which the code is being run on. The Byte code is used by the virtual machine (Python interpreter) and converted into machine code (binary) which is machine dependent. The Byte code are similar to the microprocessor instructions. e.g. MOV AX, 10 (This is not a python bytecode) and these instructions are stored in ".pyc" files (compiled Python). You can run your ".pyc" files on any machine without the actual python source code. These files are usually generated automatically on first time execution of a python program, but you may use python package "py_compile" to generate the files. I hope I have answered your question. Happy coding!
14th May 2019, 5:37 PM
G P
G P - avatar
+ 1
A byte code is a intermediate code generated by the program compiler and interpreted by the program interpreter .This byte code is machine independent.The intermediate stage of source code is byte code.
15th May 2019, 4:43 PM
Asif Rahman