Re: passing variables as object attributes

2010-08-17 Thread Vikas Mahajan
I got the concept to get and set object attributes and now can handle similar problems effectively. Thanks to all for your help. -- http://mail.python.org/mailman/listinfo/python-list

passing variables as object attributes

2010-08-16 Thread Vikas Mahajan
Hello to all I am new to python. I am facing problem to use variables as object attributes. I have to use loop and dynamically add attributes to a object and for this purpose I have to use variables with object names. For example-: Let us say object car has an attribute engine, then varname =

Re: passing variables as object attributes

2010-08-16 Thread Vikas Mahajan
On 16 August 2010 19:23, Nitin Pawar nitinpawar...@gmail.com wrote: you would need to define a class first with its attiributes and then you may want to initiate the variables by calling the class initilializer Actually I have to dynamically add attributes to a object. I am writing python

Re: passing variables as object attributes

2010-08-16 Thread Vikas Mahajan
@All Thanks a lot. getattr and setattr functions solved my problem. -- http://mail.python.org/mailman/listinfo/python-list