[issue39506] operator |= on sets does not behave like the update method

2020-01-31 Thread Ammar Askar
Ammar Askar 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,

[issue39506] operator |= on sets does not behave like the update method

2020-01-31 Thread Gabriele Tornetta
New submission from Gabriele Tornetta : def outer(): a=set() def inner(): a |= set(["A"]) inner() return a print(outer()) Traceback (most recent call last): File "main.py", line 8, in print(outer()) File "main.py", line 5, in outer inner() File "main.py", line 4, in