Question re: eval()
D-Man
dsh8290 at rit.edu
Sat Dec 30 23:55:31 EST 2000
On Fri, Dec 29, 2000 at 09:03:49AM -0800, Clarence Gardner wrote:
>
<snip>
> class D:
<snip>
>
> 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
functions.
>
> TIA,
> Clarence Gardner
> clarence at netlojix.com
HTH,
-D
More information about the Python-list
mailing list