In my GUI application, I assign values to _register_allowed which is in the main function from a nested function inside main.
def toggle_registration():
if _register_allowed:
_register_allowed = False
else:
_register_allowed = True
this will then of course return a UnboundLocalError.
My question is, why is using the global declaration keyword to solve this a bad thing?
Since it achieves the same end result as nonlocal, i.e. that the value that the _register_allowed from outside the scope of the nested function is changed rather than a new local variable being created; why is this a bad, or un-Pythonic way to solve this?