[Solved] Questions about default args, Python:
Trying to understand some stuff in a SO discussion. 1) When the interpreter reaches a func header for the 1st time and then jumps over the body to resume in global scope, we see that the func name gets added to the global namespace. We can say that func header is evaluated, right? 2) If yes, why can't I see the default argument also in gs? What can I do to see it before I actually call the function? (dir, vars etc didn't work) 3) Arguments passed are local to the func. But are default args also? 4) Why would a list keep changing when passed as default, if it were local to the function? (Is it something like a closure, in func object state) EDIT: Changed my mind and added the two other questions. The discussion I mentioned is at https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument?rq=1