Hi,
Thanks to the help of many on this list, I've been able to take code
that is created by the user in my app and add it to an object as an
instance method. The technique used is roughly:
nm = myMethod
code = def myMethod(self):
print Line 1
print My Value is %s % self.Value
Ed Leafe wrote:
Hi,
Thanks to the help of many on this list, I've been able to take code
that is created by the user in my app and add it to an object as an
instance method. The technique used is roughly:
nm = myMethod
code = def myMethod(self):
print Line 1
print My
Ed Leafe wrote:
Hi,
Thanks to the help of many on this list, I've been able to take code
that is created by the user in my app and add it to an object as an
instance method. The technique used is roughly:
Just some notes about your code:
nm = myMethod
code = def myMethod(self):
On Mar 14, 2006, at 12:45 PM, Ziga Seilnacht wrote:
Try not using bare exec statements, since they pollute the local
scope.
In your example you could use:
compCode = compile(code, , exec)
d = {}
exec compCode in d
func = d[nm]
OK, noted and changed in my source.
exec self.%s