Does any language or debug tool have a way to print out the scope chain for examination, so as to look at the different situations of what a scope chain contains?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Firebug does for JavaScript. On the ‘Watch’ tab of the ‘Script’ debugger you can open up the scope chain list a look at each parent scope.
Python can read locals from a parent scope in the language itself if you grab a code object, but the way it handles nested scopes means that only the scoped variables that are actually used are bound:
Though both
v1andv2are defined in the parent scope, onlyv1is actually closed over.