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 Robert Haschke
Recipients Robert Haschke
Date 2020-09-28.19:12:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601320340.36.0.581578891193.issue41878@roundup.psfhosted.org>
In-reply-to
Content
The attached file implements a custom dict-like class (MyDict) as a minimal example of code I am using in a larger codebase. 
Before you ask, why I reimplemented a dict-like object: The real code base employs a hierarchical dict, referencing recursively to the parent dict, if a key cannot be found in the current dict.

The main code of the file defines two entries/variables for this dict:
symbols = MyDict()
symbols['abc'] = '[1, 2, 3]'
symbols['xyz'] = 'abc + abc'

and eval_text('xyz', symbols) should evaluate to the python expression as you would have evaluated those variables in a python interpreter.
While this works for the first given expression (above), it fails for this one:
symbols['xyz'] = '[abc[i]*abc[i] for i in [0, 1, 2]]'

raising NameError: name 'abc' is not defined.
The same code works perfectly in python 2.7. Hence, I assume this is a bug in python3.
History
Date User Action Args
2020-09-28 19:12:20Robert Haschkesetrecipients: + Robert Haschke
2020-09-28 19:12:20Robert Haschkesetmessageid: <1601320340.36.0.581578891193.issue41878@roundup.psfhosted.org>
2020-09-28 19:12:20Robert Haschkelinkissue41878 messages
2020-09-28 19:12:20Robert Haschkecreate