You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is perhaps a bit obscure, but here's a class of syntax errors that aren't caught by pyflakes
$ cat test.py
def test(x):
global x
$ pyflakes test.py
$ python test.py
File "test.py", line 2
global x
SyntaxError: name 'x' is parameter and global
I'm unsure what the full set of possible errors are here. One would need to check the Python source. I know there are some others relating to the Python 3 "nonlocal" keyword as well.
Another related one is nonlocal after a variable definition
$ cat test2.pydef test(): a = 2 nonlocal a
$ python test2.py File "test2.py", line 3 nonlocal a ^SyntaxError: name 'a' is assigned to before nonlocal declaration
$ pyflakes test2.py # no errors
Activity
asmeurer commentedon Nov 4, 2017
Just hit the nonlocal one. Would definitely be nice if pyflakes properly warned about these.
Closes PyCQA#249
Closes PyCQA#249
Catch usage of undefined name with global statement
Catch usage of undefined name with global statement
asmeurer commentedon Feb 8, 2019
Another related one is
nonlocalafter a variable definitionvkrmjeet commentedon Dec 1, 2021