New submission from pest <l...@asterisk.co.nz>: Assignments to vars() behave incorrectly if those variables are use later on in a function.
For example, try this: ====== #!/usr/bin/python def zz(): for i in [1,2,3]: for j in [4,5,6]: vars()['fw_%s_%s' % (j,i)] = 'test %s %s' % (j, i) print vars()['fw_%s_%s' % (j,i)] fw_4_2 = 'zz' print fw_4_2 zz() ====== The assignments work fine up till 4_2. At 4_2, the assignment apparently fails silently, and the print raises a keyError exception. ---------- components: None messages: 81530 nosy: pest severity: normal status: open title: vars() assignment fails silently when assignments made later type: behavior versions: Python 2.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5197> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com