Steven D'Aprano added the comment: I wonder if it is a left-over from the behaviour prior to 3.2? In 3.1, I get this syntax error:
py> def outer(): ... spam = 1 ... def inner(): ... nonlocal spam ... del spam ... inner() ... SyntaxError: can not delete variable 'spam' referenced in nested scope See also the "Changed in 3.2" comment here: https://docs.python.org/3/reference/simple_stmts.html#the-del-statement ---------- nosy: +steven.daprano _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24796> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com