If you were holding your breath, you can let it out now! Congratulations on completing this deep dive into scopes and closures in Python. By using the debugger Thonny, you’ve walked through a code snippet to better understand how scopes and closures work.
In this Code Conversation video course, you:
- Refactored code to use more descriptive names
- Learned about local and nonlocal scopes and how functions access variables
- Understood how scopes open and close through inner and outer function calls
You used your interpreter to dig into Python and inspect dunder objects to find out how Python handles and stores variables.
For more informaton on the concepts covered in this video course, you can check out:
Christopher Conlon on May 31, 2022
Interesting for those who are curious about how Python works under the hood. Unlikely to be much use to those who are only interested in practical Python application building (but could be).
It is sort of like the difference between working inside the space station and strapping on the EVA suit and taking a look at or working on the space station itself. If you are out there tinkering around with the solar panels then you are working on something completely different from running experiments inside. However, the inside work is dependent on that outside work.
Also, it is fun to step outside on an Extra Vehicular Activity.