Ammar Askar <am...@ammaraskar.com> added the comment:

Take a look at 
https://docs.python.org/3/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value

What's happening is that because `a |= x` is treated as an assignment, i.e `a = 
a | x`. The compiler treats it as a local variable, but since it hasn't been 
initialized in inner() before it reaches `a |= set(["A"])` it fails with 
UnboundLocalError.

----------
nosy: +ammar2
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39506>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to