On Thu, May 26, 2005 at 11:52:36PM +0200, Dieter Maurer wrote: > Chris Withers wrote at 2005-5-25 21:03 +0100: > > ... > >> I strongly argue against it. Fix "hasattr" in the Zope context, > >> instead! > > > >Make it so! :-) > > _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?
Are you currently running zope with a patch like this? Have you noticed any performance difference? the zope 2.6 source code contains over 700 calls to hasattr()... > Now, there need only to be someone who checks it in. Well, first I think it should be discussed on zope-dev... unless it already has been? I'll post a message there. -- Paul Winkler http://www.slinkp.com _______________________________________________ Zope maillist - [email protected] http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
