Changing the private variables content
Xavier Ho
contact at xavierho.com
Wed Jul 22 08:45:37 EDT 2009
On Wed, Jul 22, 2009 at 10:29 PM, Ryniek90 <ryniek90 at gmail.com> wrote:
> Thanks for hint, but looks like i can't do what i want.
That's because
>
> def _SetVar(self, attr, val):
> self.attr = val
doesn't work as you might think. However, I tried to replace it with:
val('self.' + attr + '=\'' + val + '\'')
and it gives me a syntax error!
File "test.py", line 7, in _setVar
eval('self.' + attr + '=\'' + val + '\'')
File "<string>", line 1
self.var='Mrra'
^
SyntaxError: invalid syntax
So, uh, I'm wondering if this is a bug. And also the solution to his
problem.
Good luck. Any ideas appreciated.
Ching-Yun "Xavier" Ho, Technical Artist
Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: contact at xavierho.com
Website: http://xavierho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090722/44ef6fd3/attachment-0001.html>
More information about the Python-list
mailing list