[Zope-Checkins] CVS: Zope3/src/ZODB - Connection.py:1.114.2.1coptimizations.c:1.26.6.1 serialize.py:1.2.10.1

Casey Duncan casey at zope.com
Sun Jan 11 01:06:37 EST 2004


On Sun, 11 Jan 2004 00:45:57 -0500
Jeremy Hylton <jeremy at zope.com> wrote:

> On Sat, 2004-01-10 at 22:17, Casey Duncan wrote:
> > > Nope.  You're thinking of getattr() there.  hasattr() swallows all
> > > exceptions (even SystemExit!).
> > 
> > Is this behavior considered a Python bug? If not, why?
> 
> It is not considered a bug, but I've always chalked that up to not
> being Dutch.

Well I suppose if getattr raises SystemExit, hasattr can safely assume
that the attribute doesn't exist and return False. It's the least it can
do, really ;^)

Has anyone written an essay entitled "hasattr considered harmful" yet? I
must admit I always feel a bit dirty everytime I use it, and this
doesn't help my self-image at all...

-Casey



More information about the Zope-Checkins mailing list