Question re: eval()
dsh8290 at rit.edu
Sun Dec 31 05:55:31 CET 2000
On Fri, Dec 29, 2000 at 09:03:49AM -0800, Clarence Gardner wrote:
> class D:
> d = D()
> x = eval('n + 1', d)
> but the eval function accepts only a dictionary as the second parameter.
> Is there any amazing way to do this?
Make D a dictionary. Have it inherit from UserDictionary (I don't
know which module it is in) and implement the necessary lookup
> Clarence Gardner
> clarence at netlojix.com
More information about the Python-list