[Python-ideas] @setattr(obj, [name])

George Sakkis george.sakkis at gmail.com
Sun Jun 6 22:43:22 CEST 2010


On Sun, Jun 6, 2010 at 6:16 PM, David Stanek <dstanek at dstanek.com> wrote:
> On Sun, Jun 6, 2010 at 8:30 AM, George Sakkis <george.sakkis at gmail.com> wrote:
>>
>> Thoughts ?
>>
>
> I'm not sure I understand why you would want to do this. I may just be
> combative because I hate the over use of decorators.

It depends on what you mean by "this"; binding a function (or class)
to an object as an attribute, or using a decorator to achieve it ? I
find a decorator quite elegant in this case, although the use case
itself is admittedly much less common in Python than, say, Javascript
(with ``obj.property = function(x,y) {...}`` expressions everywhere).

George



More information about the Python-ideas mailing list