Re: Get attribute this way

2009-11-17 Thread Diez B. Roggisch
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

Re: Get attribute this way

2009-11-17 Thread Carl Banks
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

Re: Get attribute this way

2009-11-17 Thread Bruno Desthuilliers
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

Get attribute this way

2009-11-16 Thread King
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

Re: Get attribute this way

2009-11-16 Thread Chris Rebert
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

Re: Get attribute this way

2009-11-16 Thread King
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

Re: Get attribute this way

2009-11-16 Thread Chris Rebert
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]

Re: Get attribute this way

2009-11-16 Thread King
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 --