[ZODB-Dev] Persistent-derived class instances always callable

Shane Hathaway shane at zope.com
Mon Oct 20 23:34:23 EDT 2003


On 10/18/03 02:03, Tim Peters wrote:
> [Shane Hathaway]
>>Consider that there are two kinds of weakref proxies: callable and
>>non-callable.  AFAIK the only reason for this is to work around the
>>expectations of callable().
> 
> I'm sure it's much more for efficiency.

I think the efficiency argument is incorrect, but instead of argue, I'd 
just like to explain why this issue matters to me.

The fact that proxies are even possible in Python is a very neat trick. 
  I hope that Python will explore how transparent proxies can/should be. 
  Proxies solve major problems in OO design.  They are more interesting 
than "aspects", another relatively new OO pattern, since proxies let you 
cleanly modify the behavior of individual instances (without even 
changing the instances), while aspects aren't so granular; aspects 
modify the behavior of all instances of a given class.

I'm not concerned about ExtensionClass.  Everyone knows it breaks some 
expectations and people work around that.  I'm concerned about the 
future prospects for writing proxy-like classes (both in C and Python.) 
  The fact that weakref chose the dual-type strategy makes me uneasy 
about writing proxy classes; who knows what Python will add next that 
can't be emulated by proxies?  I want to be sure Python continues to 
support proxies well.

If callable() is the only thing that demands multiple proxy classes, 
that's not too bad.  Let's not add any more.

Shane




More information about the ZODB-Dev mailing list