Re: [Zope-dev] hasattr implementation for Zope?
On Fri, May 27, 2005 at 08:53:54AM +0100, Chris Withers wrote: > Anyone think putting this in Zope core is a good idea? > > If so, where should it go? > Any potential performance implications people can think of? fwiw, tonight I ran some quick request-per-second tests (using ab -n 100 -c 10) on a patched vs. an unpatched zope 2.7.6 final. I was hitting the front page of a CMFDefault site because I had one handy on my dev box. (but I should try Plone for this :=) I wasn't able to see any consistent performance difference. At first I thought that the patched version was a bit slower when concurrency was increased to 20, but that only happened on one run so maybe it was a fluke. I put the patch in Globals.py for no particular reason. -- Paul Winkler http://www.slinkp.com ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] hasattr implementation for Zope?
Dieter Maurer wrote: I strongly argue against it. Fix "hasattr" in the Zope context, instead! _marker = [] def hasattr(obj, attr, marker): a = getattr(obj, attr, _marker) return a is not _marker import __builtin__ __builtin__.hasattr = hasattr Easy enough, isn't it? Way easier than to change "hasattr" anywhere it is now used. Anyone think putting this in Zope core is a good idea? If so, where should it go? Any potential performance implications people can think of? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )