properties + types, implementing meta-class desciptors elegantly?

Mike C. Fletcher mcfletch at rogers.com
Sat Jul 19 07:47:03 EDT 2003


Bengt Richter wrote:

>On Fri, 18 Jul 2003 08:48:44 -0400, "Mike C. Fletcher" <mcfletch at rogers.com> wrote:
>  
>
...

>Not sure exactly what you are doing, but what does
>
>     object.__setattr__(client, self.name, value)
>
>do in your context in place of
>
>     client.__dict__[ self.name ] = value
>
>?
>  
>
__setattr__ invokes the entire tree of setattr machinery, *including* 
descriptor interception, so it just creates an infinite loop when used 
in descriptors.  What I'm looking for is a (set of) 
method(s)/function(s) for use when constructing descriptors which allow 
for simply setting the value without going through the new setattr 
machinery.  In effect, a function which knows how to do the equivalent 
of "client.__dict__[ name ] = value" for all built-in objects (objects, 
classes, __slot__ holding instance, etceteras).

Hooks into which to hook is my goal, really.  A lower-level API for 
doing what's normally done once you're done pre-processing the 
setting/getting/deleting "event".

Have fun,
Mike

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/








More information about the Python-list mailing list