King schrieb:
eval can solve this problem right away but I am concerned about
security issues. If not eval could you suggest something more
efficient way. It won't be a big deal to change the format as
application is still at development stage?
If you don't want to use eval (which is a good
On Nov 16, 11:37 pm, King animator...@gmail.com wrote:
eval can solve this problem right away but I am concerned about
security issues. If not eval could you suggest something more
efficient way. It won't be a big deal to change the format as
application is still at development stage?
You
access
__getattribute__ (nor most __magic_methods__ FWIW).
print getattr(o, name)
This is the easiest way to get an attribute using a string.
In my case the Node class load/creates all the attributes from a xml
file.
Example
Input name=position type=float value=0.5/
Input name=color type=color
Python's getattr, setattr and __getattribute__ commands works fine
with python types.
For example:
print o.__getattribute__(name)
print getattr(o, name)
This is the easiest way to get an attribute using a string.
In my case the Node class load/creates all the attributes from a xml
file.
Example
On Mon, Nov 16, 2009 at 10:04 PM, King animator...@gmail.com wrote:
Python's getattr, setattr and __getattribute__ commands works fine
with python types.
For example:
print o.__getattribute__(name)
print getattr(o, name)
This is the easiest way to get an attribute using a string.
In my
Writing/Reading data to xml is not a problem. The problem is when I
have to write to attributes in xml, where a connections has been
established.
XML:
Connection sourceattribute=node1.gradient.colors[0][1]
destattribute=node2.gradient.colors[1][2]/
While reading back I have to convert both source
On Mon, Nov 16, 2009 at 10:53 PM, King animator...@gmail.com wrote:
Writing/Reading data to xml is not a problem. The problem is when I
have to write to attributes in xml, where a connections has been
established.
XML:
Connection sourceattribute=node1.gradient.colors[0][1]
eval can solve this problem right away but I am concerned about
security issues. If not eval could you suggest something more
efficient way. It won't be a big deal to change the format as
application is still at development stage?
Thanks
Prashant
Python 2.6.2
Win XP 32
--