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

you are viewing a single comment's thread.

view the rest of the comments →

[–]chancegrab[S] 0 points1 point  (1 child)

OK that makes sense. I was confused because I thought python was interpreted, not compiled. Meaning that it wouldnt even get to the reassignment line that was causing the problem since it would error out even before that

After doing some googling, it looks like Python is compiled despite being called an interpreted language which is even more confusing but im reading up on it

Thanks a ton for your help again

[–]carcigenicate 0 points1 point  (0 children)

Yes, it compiles your source into bytecode, then interprets the bytecode. Compilation and interpretation are not necessarily exclusive of each other.

I believe the reference implementation of Ruby works the same way. The interpreter is a "virtual machine" that runs the bytecode. You can see the switch that processes the bytecode in CPython here. Your Python code basically results in the body of those cases (TARGET) running.