Bypassing __getattribute__ for attribute access

Adam Donahue adam.donahue at gmail.com
Fri Oct 26 20:33:06 CEST 2007


Thank you all for the detailed replies, I appreciate it.  I only read
up on this yesterday morning, but I feel I've gotten a lot of insight
in a short time thanks to your contributions to this thread.  Useful
all around!

Adam

On Oct 26, 2:50 am, Bruno Desthuilliers <bruno.
42.desthuilli... at wtf.websiteburo.oops.com> wrote:
> Chris Mellon a écrit :
>
> > On Thu, 2007-10-25 at 23:13 +0200, Bruno Desthuilliers wrote:
> > <snip excellent breakdown>
>
> <blush />
>
> >> Dynamically adding methods to classes is pretty
> >> straightforward, the tricky point is to dynamically add methods to
> >> instances, since the descriptor protocol is only triggered for class
> >> attributes. But you obviously found how to do it using func.__get__(obj,
> >> type(obj)) !-)
>
> > This is the greasy, getting your hands dirty way. I vastly prefer (and
> > reccomend) using the new module:
>
> Indeed.





More information about the Python-list mailing list