[Zope-dev] Re: "hasattr" geddon

Dieter Maurer dieter at handshake.de
Mon Jul 12 12:34:24 EDT 2004


Shane Hathaway wrote at 2004-7-10 02:41 -0600:
> ...
>Hmm.  I just heard about this "hasattr geddon".  hasattr is *good*.  Why are 
>we fixing hasattr and bare excepts when the real problem is ZODB?

That's even better!

However, we may still be interested to get an exception unswallowed
by "hasattr". Usually, there is some sense in not continuing
an expensive computation when we know it will finally fail...

When we fix ZODB, we should note that information about the precise
cause is helpful in fixing the underlaying problem.
Thus, something like the original exception, maybe even with a
traceback representation, should be available.

> ...
>That said, I was surprised to discover that Python 2.3 implements hasattr this 
>way (from bltinmodule.c):

Me, too...

> ...
>I suggest 
>the consistency between getattr and hasattr should be fixed in Python, not 
>Zope.

Tim explained a bit why "hasattr" is like it is...

And when we cannot change it in Python, we may need our own "hasattr"...


-- 
Dieter


More information about the Zope-Dev mailing list