Mathieu Prevot a écrit :
2008/9/4 Chris Rebert <[EMAIL PROTECTED]>:

(snip)

You're looking for the setattr() built-in function. In this exact case:
   setattr(a, arg, new_value)

This is probably covered in the Python tutorial, please read it.

Regards,
Chris

Indeed.

I'll use:
a.__setattr__(height, new_value)

Please don't. Use the generic setattr() function instead. This holds for any __magic__ method : they are *implementation* for operators and generic functions - which you can think of as operators with a function syntax -, and are not meant to be called directly. You wouldn't write something like 2.__add__(3), would you ?

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to