delegation pattern via descriptor

Steven D'Aprano steve-REMOVE-THIS at cybersource.com.au
Tue Jul 6 01:11:09 EDT 2010


On Mon, 05 Jul 2010 21:12:47 -0700, kedra marbun wrote:

> On Jul 5, 7:49 am, Gregory Ewing <greg.ew... at canterbury.ac.nz> wrote:
>> kedra marbun wrote:
>> > now, i'm asking another favor, what about the 2nd point in my 1st
>> > post?
>>
>> Your original post has dropped off my newsscope, so you'll have to
>> remind me what the 2nd point was.
>>
>> --
>> Greg
> 
> it's like 'name', it's about info that i think should be passed to
> descriptor's __{get|set|delete}__. i wonder what are the reasons for not
> passing the class on which the descriptor is attached to, what pattern
> is encouraged by this?



Perhaps I'm missing the context, but since the descriptor is passed the 
instance, you can easily get the class with type(self) or self.__class__. 
There's no need to pass the class as a separate argument.



-- 
Steven




More information about the Python-list mailing list