Re: [Zope-dev] Re: hasattr implementation for Zope?

2005-05-28 Thread Dieter Maurer
Tres Seaver wrote at 2005-5-27 08:22 -0400: ... As a local patch, this isn't too bad (one could even package it as a do-nothing-after-initialization product). However, no redistributed product code should rely on the presence of a patched 'hasattr', but should use the 3 argument getattr instead.

Re: [Zope-dev] Re: hasattr implementation for Zope?

2005-05-28 Thread Dieter Maurer
Jim Fulton wrote at 2005-5-27 11:49 -0400: ... I'm sure this was an unintentional non-acceptance. It would be a lot easier if Dieter became a contributor and checked this in himself. You know the unqualified indemnification clause concerning patents it preventing me... -- Dieter

Re: [Zope-dev] Re: hasattr implementation for Zope?

2005-05-28 Thread Dieter Maurer
Paul Winkler wrote at 2005-5-27 11:02 -0400: ... def safe_hasattr(obj, attr, acquired=True, _marker=[]): if not acquired: obj = aq_inner(aq_explicit(obj)) This should be obj = aq_base(obj). The aq_explicit(aq_inner(...)) dance is only necessary in untrusted code as aq_base is not

Re: [Zope-dev] RAMcache and container vs. context

2005-05-28 Thread Dieter Maurer
Stefan H. Holek wrote at 2005-5-27 10:59 +0100: A TALES expression may be prohibitively expensive in any case, no matter how simple it is kept. Please make sure to do some comparative profiling. Cache keys are recomputed on every call of the script, AFAICS. The thought of doing this in

Re: [Zope-dev] Re: hasattr implementation for Zope?

2005-05-28 Thread Dieter Maurer
Tim Peters wrote at 2005-5-27 13:49 -0400: ... def lookup1(arg, _marker=object()): return _marker ... _marker = object() def lookup3(arg): return _marker ... lookup1 0.427597 lookup3 0.404399 Do you understand why lookup3 is faster than lookup1? I had the impression that access to

Re: [Zope-dev] Re: hasattr implementation for Zope?

2005-05-28 Thread Tim Peters
[Tim Peters] def lookup1(arg, _marker=object()): return _marker ... _marker = object() def lookup3(arg): return _marker ... lookup1 0.427597 lookup3 0.404399 [Dieter Maurer] Do you understand why lookup3 is faster than lookup1? I had the impression that access to the

Re: [Zope-dev] Re: hasattr implementation for Zope?

2005-05-28 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dieter Maurer wrote: Tres Seaver wrote at 2005-5-27 08:22 -0400: ... As a local patch, this isn't too bad (one could even package it as a do-nothing-after-initialization product). However, no redistributed product code should rely on the presence