Evening all, Here's a brief chat with the interpretator:
Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def fib(x): ... if (x == 1): ... return 1 ... else: ... return x * fib((x - 1)) ... >>> import dis >>> dis.dis(fib) 2 0 LOAD_FAST 0 (x) 3 LOAD_CONST 1 (1) 6 COMPARE_OP 2 (==) 9 JUMP_IF_FALSE 8 (to 20) 12 POP_TOP 3 13 LOAD_CONST 1 (1) 16 RETURN_VALUE 17 JUMP_FORWARD 19 (to 39) >> 20 POP_TOP 5 21 LOAD_FAST 0 (x) 24 LOAD_GLOBAL 1 (fib) 27 LOAD_FAST 0 (x) 30 LOAD_CONST 1 (1) 33 BINARY_SUBTRACT 34 CALL_FUNCTION 1 37 BINARY_MULTIPLY 38 RETURN_VALUE >> 39 LOAD_CONST 0 (None) 42 RETURN_VALUE I'm no bytecode connoisseur, but having read <http://docs.python.org/lib/bytecodes.html>, i more or less get this. What puzzles me, though, are bytecodes 17, 39 and 42 - surely these aren't reachable? Does the compiler just throw in a default 'return None' epilogue, with routes there from every code path, even when it's not needed? If so, why? tom -- News flash: there's no deep meaning or hidden message BECAUSE DAVID LYNCH IS INSANE -- http://mail.python.org/mailman/listinfo/python-list