+ 2
The call stack how works?
def func_A(): func_D() func_B() return def func_B(): return def func_C(): func_B() func_E() return def func_D(): func_C() return def func_E(): print("call stack") return who does this work friends help? Is it called like this? func_e func_d func_c func_b func_a if the func_a is called
7 Respostas
+ 4
A very simple way to find this out is to add print statements in each function describing which function was called, like so
https://code.sololearn.com/c9GmiTD9eHK6/?ref=app
+ 3
hi Aid
the stack is a mathematical contruct which works like...
last one inline first one out
so when you call func_A() executes the first line immediately puttung func_D() at the top of the stack. func_D() then resolves putting func_C at the top of the stack and so on.
does that make sense?
+ 2
Ollie Q please tell me where the stack will remain empty?
+ 2
Ollie Q after function func_a?
+ 2
Ollie Q but the stack will eventually get empty after func_a returns .
+ 1
You can add to each function print("func_X") and see how it works.
Where the X will be the letter from function name
+ 1
Aid
the stack will not empty because by the time a call to func_B is executed their will be other functions still on the stack to resolve and the interpriter will go through them to