All-
It seems like when I have a function that does "del" on a global variable,
flake complains that a local variable is referenced before assignment.  As
far as I know, the following is valid code:

server = None

def stopServer():
    global server
    if server:
        del server
        server = None

test.py:6:8: F823 local variable 'server' (defined in enclosing scope on
line 1) referenced before assignment

I'm using flake --version: 2.1.0 (pep8: 1.4.6, mccabe: 0.2.1, pyflakes:
0.7.3)

I understand that the "del" statement is redundant, but I don't think that
it is wrong, per se. Is this code actually incorrect? If not, is there a
way to suppress this error message? I'm interested in figuring this out as
part of an effort to convince a coworker to start using flake on his/her
code.

Thanks -
Dan W.
_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to