Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
locals() and globals()
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Kay Schluehr, post: 2039990"] Python is statically scoped. The name bindings are fixed at compile time. Hence you can't achieve dynamic scoping by using the locals() dictionary and add new names to the locals() which might eventually be used as local variables in the body of the function. The function still controls its own state and does not permit delegating state changes via locals(). That's what objects are for. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
locals() and globals()
Top