¡@

Home 

python Programming Glossary: dis.dis

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

Foo ... x 5 ... y x for i in range 1 ... return Foo ... dis.dis foo 2 0 LOAD_BUILD_CLASS 1 LOAD_CONST 1 code object Foo at.. code object Foo at 0x10a436030 file stdin line 2 'Foo' dis.dis foo.__code__.co_consts 1 2 0 LOAD_FAST 0 __locals__ 3 STORE_LOCALS.. file stdin line 4 'foo. locals .Foo. listcomp ' 1 None dis.dis foo.__code__.co_consts 1 .co_consts 2 4 0 BUILD_LIST 0 3 LOAD_FAST..

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

07 20 39 import dis def f x ... return x is not None ... dis.dis f 2 0 LOAD_FAST 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..

Python division

http://stackoverflow.com/questions/2958684/python-division

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

pass def while_true while True pass print while 1 print dis.dis while_one print while True print dis.dis while_true produces.. while 1 print dis.dis while_one print while True print dis.dis while_true produces the following results while 1 4 0 SETUP_LOOP..

Cyclic module dependencies and relative imports in Python

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

look at the byte code def foo ... from foo import bar dis.dis foo 2 0 LOAD_CONST 1 1 3 LOAD_CONST 2 'bar' 6 IMPORT_NAME..

Are tuples more efficient than lists in Python?

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

y x 2 ... def b ... x 1 2 3 4 5 ... y x 2 ... import dis dis.dis a 2 0 LOAD_CONST 1 1 3 LOAD_CONST 2 2 6 LOAD_CONST 3 3 9.. 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

BUILD_LIST outweighs LOAD_ATTR CALL_FUNCTION . import dis dis.dis compile s s.append 'spam' '' 'exec' 1 0 BUILD_LIST 0 3 STORE_NAME.. 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 0..

Why is early return slower than else?

http://stackoverflow.com/questions/8271139/why-is-early-return-slower-than-else

Here are the results of the disassembly in Python 2.7 dis.dis without_else 2 0 LOAD_FAST 0 param 3 POP_JUMP_IF_FALSE 10 3.. 1 1 9 RETURN_VALUE 4 10 LOAD_CONST 2 0 13 RETURN_VALUE dis.dis with_else 2 0 LOAD_FAST 0 param 3 POP_JUMP_IF_FALSE 10 3 6..

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

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

result import dis def notin 'ham' not in 'spam and eggs' dis.dis notin 2 0 LOAD_CONST 1 'ham' 3 LOAD_CONST 2 'spam and eggs'.. 13 RETURN_VALUE def not_in not 'ham' in 'spam and eggs' dis.dis not_in 2 0 LOAD_CONST 1 'ham' 3 LOAD_CONST 2 'spam and eggs'.. 13 RETURN_VALUE def not__in not 'ham' in 'spam and eggs' dis.dis not__in 2 0 LOAD_CONST 1 'ham' 3 LOAD_CONST 2 'spam and eggs'..