Re: setattr and getattr, when to use?

2008-08-26 Thread Bruno Desthuilliers
Jason Scheirer a écrit : (snip) The 5% of your time when you are doing metaprogramming or other abuses of the object system are when you use get/setattr. What makes you label metaprogramming and get/setattr as abuses ??? -- http://mail.python.org/mailman/listinfo/python-list

Re: setattr and getattr, when to use?

2008-08-23 Thread Steven D'Aprano
On Fri, 22 Aug 2008 20:50:17 -0700, maestro wrote: Why are these functions there? Is it somehow more idiomatic to use than to do obj.field ? Heavens no!!! Using setattr and getattr is *less* idiomatic. Is there something you can with them that you can't by obj.field reference?

setattr and getattr, when to use?

2008-08-22 Thread maestro
Why are these functions there? Is it somehow more idiomatic to use than to do obj.field ? Is there something you can with them that you can't by obj.field reference? -- http://mail.python.org/mailman/listinfo/python-list

Re: setattr and getattr, when to use?

2008-08-22 Thread Jason Scheirer
On Aug 22, 8:50 pm, maestro [EMAIL PROTECTED] wrote: Why are these functions there? Is it somehow more idiomatic to use than to do obj.field ? Is there something you can with them that you can't by obj.field reference? You can generate them dynamically from strings. In some cases you don't

Re: setattr and getattr, when to use?

2008-08-22 Thread Jason Scheirer
On Aug 22, 10:17 pm, Jason Scheirer [EMAIL PROTECTED] wrote: On Aug 22, 8:50 pm, maestro [EMAIL PROTECTED] wrote: Why are these functions there? Is it somehow more idiomatic to use than to do obj.field ? Is there something you can with them that you can't by obj.field reference? You