[Python-ideas] Assignment decorators (Re: The Descriptor Protocol...)
Terry Reedy
tjreedy at udel.edu
Mon Mar 7 01:51:02 CET 2011
On 3/5/2011 11:10 PM, Greg Ewing wrote:
> MRAB wrote:
>> On 05/03/2011 22:53, Greg Ewing wrote:
>>
>>> Another approach might be to make it a standard part of the
>>> class creation process to go through the attribute dict
>>> looking for objects with __setname__ methods and calling
>>> them. That would mean the feature would only be available
> >
>> With classes, couldn't that be done just as easily now with a decorator?
>
> I suppose it could, but then the burden is on the user to
> apply the decorator to each class in which he wants to use
> things that rely on it. That doesn't seem very satisfactory.
Much more satisfactory than an 'assignment decorator', which put more
burden on the user and break the current meaning of 'decorator'.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list