Function inside function - every time?
Let we have this code: def big_function(): def little_function(): ....... ......... The Python documentation says about def statement: A function definition is an executable statement. Its execution binds the function name... So, the question is: Does def little_function() execute every time when big_function is invoked? Question is about def statement exactly, not the little_function() body. You can check the bytecode with the dis module: >>> import dis >>> def my_function(): ... def little_function(): ... print "Hello, World!" ... ... >>> dis.dis(my_function) 2 0 LOAD_CONST 1 (<code object