[Zope-dev] hasattr implementation for Zope?

Chris Withers chris at simplistix.co.uk
Fri May 27 03:53:54 EDT 2005


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



More information about the Zope-Dev mailing list