delegation pattern via descriptor

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Jul 9 22:02:00 EDT 2010


kedra marbun wrote:
> this 'passing class' thing comes from,
> IIRC, learning python 4ed by Mark Lutz, it's stated there that the 3rd
> arg to __get__ is the class to which the descriptor instance is
> attached

That's there so that the __get__ method of function
objects can return an unbound method when looked up
on a class rather than an instance of the class.

There is no corresponding use case for a class argument
to __set__ or __delete__, so they don't have one.

-- 
Greg



More information about the Python-list mailing list