Python's 'UnboundLocalError' — It's Not a Missing Variable, It's Scope Decided in Advance
DEV Community
Python's 'UnboundLocalError' — It's Not a Missing Variable, It's Scope Decided in Advance
The variable has a value elsewhere in your program — just not in the scope Python already decided this line belongs to. Here's how Python actually assigns scope, and why the fix usually isn't `global`.
0 comments
No comments yet.