interpreter vs. compiled

castironpi castironpi at gmail.com
Fri Jul 18 00:08:17 CEST 2008


I'm curious about some of the details of the internals of the Python
interpreter:

I understand C from a hardware perspective.

x= y+ 1;

Move value from place y into a register
Add 1 to the value in the register
Move the addition's result to place x

The Python disassembly is baffling though.

>>> y= 3
>>> dis.dis('x=y+1')
          0 SETUP_LOOP      31037 (to 31040)
          3 STORE_SLICE+3
          4 <49>

What are SETUP_LOOP and STORE_SLICE?  What are these instructions?



More information about the Python-list mailing list