delegation pattern via descriptor
Thomas Jollans
thomas at jollans.com
Sat Jul 3 05:16:19 EDT 2010
On 07/03/2010 10:59 AM, kedra marbun wrote:
> if we limit our discussion to py:
> why __{get|set|delete}__ don't receive the 'name' & 'class' from
> __{getattribute|{set|del}attr}__
> 'name' is the name that is searched
> 'class' is the class whose __dict__ has 'name' bound to descriptor
http://users.rcn.com/python/download/Descriptor.htm#descriptor-protocol
descr.__get__(self, obj, type=None) --> value
descr.__set__(self, obj, value) --> None
descr.__delete__(self, obj) --> None
These methods are passed the object they're operating on. If the name is
in any way important, which is almost certainly is not, it can either be
passed in to the constructor of the descriptor or determined by
introspection.
>
> delegator & delegator are terms from delegation pattern (oop) which is
> a specialized area of IoC
> delegate refers to helper obj, which is descriptor obj in the case of
> descriptor
> delegator is the obj that delegates task to helper obj
you are making no sense.
>
> oh crap, brazil lost, but i admit effort of the dutch is awesome
> if fifa['wc']['2010'].winner is not netherlands: raise SystemError
> #bugfix
More information about the Python-list
mailing list