¡@

Home 

python Programming Glossary: load_global

Why does Python code run faster in a function?

http://stackoverflow.com/questions/11241523/why-does-python-code-run-faster-in-a-function

a function the bytecode is 2 0 SETUP_LOOP 20 to 23 3 LOAD_GLOBAL 0 xrange 6 LOAD_CONST 3 100000000 9 CALL_FUNCTION 1 12 GET_ITER..

Accessing class variables from a list comprehension in the class definition

http://stackoverflow.com/questions/13905741/accessing-class-variables-from-a-list-comprehension-in-the-class-definition

LOAD_FAST 0 .0 6 FOR_ITER 12 to 21 9 STORE_FAST 1 i 12 LOAD_GLOBAL 0 x 15 LIST_APPEND 2 18 JUMP_ABSOLUTE 6 21 RETURN_VALUE This..

What do backticks mean to the python interpreter: `num`

http://stackoverflow.com/questions/1673071/what-do-backticks-mean-to-the-python-interpreter-num

a return `a` Disassembling shows import dis dis.dis f1 3 0 LOAD_GLOBAL 0 repr 3 LOAD_FAST 0 a 6 CALL_FUNCTION 1 9 RETURN_VALUE dis.dis..

Is a variable swap guaranteed to be atomic in python?

http://stackoverflow.com/questions/2623086/is-a-variable-swap-guaranteed-to-be-atomic-in-python

swap_xy ... global x y ... x y y x ... dis.dis swap_xy 3 0 LOAD_GLOBAL 0 y 3 LOAD_GLOBAL 1 x 6 ROT_TWO 7 STORE_GLOBAL 1 x 10 STORE_GLOBAL.. x y ... x y y x ... dis.dis swap_xy 3 0 LOAD_GLOBAL 0 y 3 LOAD_GLOBAL 1 x 6 ROT_TWO 7 STORE_GLOBAL 1 x 10 STORE_GLOBAL 0 y 13 LOAD_CONST.. of x and y could be changed by another thread between the LOAD_GLOBAL bytecodes before or after the ROT_TWO and between the STORE_GLOBAL..

Python Compilation/Interpretation Process

http://stackoverflow.com/questions/3299648/python-compilation-interpretation-process

POP_TOP 13 LOAD_FAST 0 n 16 RETURN_VALUE 17 POP_TOP 18 LOAD_GLOBAL 0 fib 21 LOAD_FAST 0 n 24 LOAD_CONST 1 2 27 BINARY_SUBTRACT.. LOAD_CONST 1 2 27 BINARY_SUBTRACT 28 CALL_FUNCTION 1 31 LOAD_GLOBAL 0 fib 34 LOAD_FAST 0 n 37 LOAD_CONST 2 1 40 BINARY_SUBTRACT..

while (1) Vs. for while(True) — Why is there a difference?

http://stackoverflow.com/questions/3815359/while-1-vs-for-whiletrue-why-is-there-a-difference

9 RETURN_VALUE while True 8 0 SETUP_LOOP 12 to 15 3 LOAD_GLOBAL 0 True 6 JUMP_IF_FALSE 4 to 13 9 POP_TOP 9 10 JUMP_ABSOLUTE..

Python function local name binding from an outer scope

http://stackoverflow.com/questions/3908335/python-function-local-name-binding-from-an-outer-scope

the bytecode of the function to use LOAD_DEREF instead of LOAD_GLOBAL and generate a cell for each value. You then pass a tuple of.. argument list. Replace appropriate occurrences of LOAD_GLOBAL with LOAD_FAST . Then construct a new function by using types.FunctionType.. and replacecment LOAD_FAST opcode.opmap 'LOAD_FAST' LOAD_GLOBAL opcode.opmap 'LOAD_GLOBAL' STORE_FAST opcode.opmap 'STORE_FAST'..