Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
Yes, that's exactly right. That's how local variables work in Python: x = 999 # global x def demo(): if False: x = 1 x # local x has no value does the same thing. This is standard, documented behaviour, regardless of which kind of assignment statement you use. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35069> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com