New submission from James Bowery <jabow...@gmail.com>:
Comment out the |= line and it prints "{'b':2}" as expected. $ cat t.py scoped_dict = {'b':2} def scoped_def(): print(scoped_dict) scoped_dict |= {'a',1} scoped_def() $ p t.py Traceback (most recent call last): File "/home/jabowery/dev/t.py", line 5, in <module> scoped_def() File "/home/jabowery/dev/t.py", line 3, in scoped_def print(scoped_dict) UnboundLocalError: local variable 'scoped_dict' referenced before assignment $ python --version Python 3.10.0 ---------- components: Parser messages: 405643 nosy: jabowery2, lys.nikolaou, pablogsal priority: normal severity: normal status: open title: |= set update scoping versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45705> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com