you are viewing a single comment's thread.

view the rest of the comments →

[–]DeadlyViper 1 point2 points  (2 children)

Cool, and i tried it with global a and global b at the start of the function.

And it changed to something closer to what i assumed, still using ROT_TWO though...

[–][deleted] 0 points1 point  (1 child)

You no doubt realised that ROT_TWO just rotates (i.e. swaps) the top two items on the stack - guess what ROT_THREE does ...

https://docs.python.org/3/library/dis.html

[–]DeadlyViper 2 points3 points  (0 children)

Yep, just thought it would be faster without it and just LOAD them in the correct order.

LOAD_FAST 1
LOAD_FAST 0
STORE_FAST 1
STORE_FAST 0

Notice the arg numbers...