This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pest
Recipients pest
Date 2009-02-10.05:14:40
SpamBayes Score 7.20277e-06
Marked as misclassified No
Message-id <>
Assignments to vars() behave incorrectly if those variables are use
later on in a function.

For example, try this:


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


The assignments work fine up till 4_2. At 4_2, the assignment apparently
fails silently, and the print raises a keyError exception.
Date User Action Args
2009-02-10 05:14:43pestsetrecipients: + pest
2009-02-10 05:14:43pestsetmessageid: <>
2009-02-10 05:14:41pestlinkissue5197 messages
2009-02-10 05:14:41pestcreate