3 ms·
Local -> Enclosing -> Global -> Builtin I use Python the most so maybe I'm just used to it but I always found scoping pretty straightforward. Do you have an e
by camel_Snake 8y ago
Local -> Enclosing -> Global -> Builtin
I use Python the most so maybe I'm just used to it but I always found scoping pretty straightforward.
Do you have an example that you found surprising?
- UncleEntity 8y agoMostly I can't remember if a variable escapes from an if-else block, context manager, &etc until I start playing around with the code. In C it's 100% clear, variables only live inside their respective blocks so if you want to mess with the value in an if-else you have to declare it outside of the block.