Closed Almas-Ali closed 5 months ago
Do you think it should throw a Radon exception or just create it as a global?
This should be like Python for now.
>>> nonlocal sdf
File "<stdin>", line 1
SyntaxError: nonlocal declaration not allowed at module level
>>> def some():
... nonlocal jhdsfg
...
File "<stdin>", line 2
SyntaxError: no binding for nonlocal 'jhdsfg' found
>>> def some():
... nonlocal abc = 234
File "<stdin>", line 2
nonlocal abc = 234
^
SyntaxError: invalid syntax
>>> abc =1243
>>> def some():
... nonlocal abc=987
File "<stdin>", line 2
nonlocal abc=987
^
SyntaxError: invalid syntax
But it will be harder to implement. And I like the current system better...
Not everything I am expecting at this moment. But, I do expect, it should not throw any Python error.
Yeah, I am not arguing against that. Will integrate into #115 because it's such a small fix. For now it will throw a Radon error. We can change it later.
Describe the bug
nonlocal
raising exception if value is not previously set.Screenshots or Code snippets