¡@

Home 

python Programming Glossary: return_value

Why does Python code run faster in a function?

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

19 JUMP_ABSOLUTE 13 22 POP_BLOCK 23 LOAD_CONST 0 None 26 RETURN_VALUE At top level the bytecode is 1 0 SETUP_LOOP 20 to 23 3 LOAD_NAME.. 19 JUMP_ABSOLUTE 13 22 POP_BLOCK 23 LOAD_CONST 2 None 26 RETURN_VALUE The difference is that STORE_FAST is faster than STORE_NAME..

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

keyword pair 16 STORE_FAST 0 Foo 5 19 LOAD_FAST 0 Foo 22 RETURN_VALUE The first LOAD_CONST there loads a code object for the Foo class.. keyword pair 44 STORE_NAME 5 y 47 LOAD_CONST 5 None 50 RETURN_VALUE The above bytecode creates the class body. The function is executed.. 2 37 JUMP_ABSOLUTE 25 40 STORE_NAME 5 y 43 LOAD_LOCALS 44 RETURN_VALUE No code object is loaded instead a FOR_ITER loop is run inline...

Python string interning

http://stackoverflow.com/questions/15541404/python-string-interning

24 BINARY_ADD 25 STORE_FAST 3 s3 28 LOAD_CONST 0 None 31 RETURN_VALUE If you were to manually intern the result of the third expression..

Python `if x is not None` or `if not x is None`?

http://stackoverflow.com/questions/2710940/python-if-x-is-not-none-or-if-not-x-is-none

0 x 3 LOAD_CONST 0 None 6 COMPARE_OP 9 is not 9 RETURN_VALUE def g x ... return not x is None ... dis.dis g 2 0 LOAD_FAST.. 0 x 3 LOAD_CONST 0 None 6 COMPARE_OP 9 is not 9 RETURN_VALUE Stylistically I try to avoid not x is y . Although the compiler..

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

3 to 6 5 3 JUMP_ABSOLUTE 3 6 LOAD_CONST 0 None 9 RETURN_VALUE while True 8 0 SETUP_LOOP 12 to 15 3 LOAD_GLOBAL 0 True .. 3 13 POP_TOP 14 POP_BLOCK 15 LOAD_CONST 0 None 18 RETURN_VALUE Using while True is noticeably more complicated. Why is this.. 3 to 6 5 3 JUMP_ABSOLUTE 3 6 LOAD_CONST 0 None 9 RETURN_VALUE while True 8 0 SETUP_LOOP 3 to 6 9 3 JUMP_ABSOLUTE 3 6 LOAD_CONST..

Cyclic module dependencies and relative imports in Python

http://stackoverflow.com/questions/6351805/cyclic-module-dependencies-and-relative-imports-in-python

12 STORE_FAST 0 bar 15 POP_TOP 16 LOAD_CONST 0 None 19 RETURN_VALUE hmm interesting so from foo import bar is translated to first..

Are tuples more efficient than lists in Python?

http://stackoverflow.com/questions/68630/are-tuples-more-efficient-than-lists-in-python

27 BINARY_SUBSCR 28 STORE_FAST 1 y 31 LOAD_CONST 0 None 34 RETURN_VALUE dis.dis b 2 0 LOAD_CONST 6 1 2 3 4 5 3 STORE_FAST 0 x 3 6 LOAD_FAST..

In Python, what is the difference between “.append()” and “+= []”?

http://stackoverflow.com/questions/725782/in-python-what-is-the-difference-between-append-and

15 CALL_FUNCTION 1 18 POP_TOP 19 LOAD_CONST 1 None 22 RETURN_VALUE dis.dis compile s s 'spam' '' 'exec' 1 0 BUILD_LIST 0 3 STORE_NAME.. 1 15 INPLACE_ADD 16 STORE_NAME 0 s 19 LOAD_CONST 1 None 22 RETURN_VALUE We can improve performance even more by removing LOAD_ATTR overhead..

Order of syntax for using 'not' and 'in' keywords

http://stackoverflow.com/questions/8738388/order-of-syntax-for-using-not-and-in-keywords

6 COMPARE_OP 7 not in 9 POP_TOP 10 LOAD_CONST 0 None 13 RETURN_VALUE def not_in not 'ham' in 'spam and eggs' dis.dis not_in 2 0 LOAD_CONST.. 6 COMPARE_OP 7 not in 9 POP_TOP 10 LOAD_CONST 0 None 13 RETURN_VALUE def not__in not 'ham' in 'spam and eggs' dis.dis not__in 2 0.. 6 COMPARE_OP 7 not in 9 POP_TOP 10 LOAD_CONST 0 None 13 RETURN_VALUE def noteq not 'ham' 'spam and eggs' dis.dis noteq 2 0 LOAD_CONST..