Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Difference between BINARY_ADD and INPLACE_ADD

$
0
0

I was going through the dis package of python. I tried code to see how it is working

>>> def get():...     x=4...     y=x+3 ............ this line...     z=8...     return y

and then run dis.dis(get) which prints the byte-code instruction for above code.

for x+3 byte-code instruction is BINARY_ADD and when went trough package docs, I found another term INPLACE_ADD

Although in there they have mentioned what is INPLACE_ADD but I did not get the difference.

I have two question

a). what is difference between BINARY_ADD and INPLACE_ADD

b). how can I write code so that byte-code instruction shows INPLACE_ADD


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>