Tim Peters wrote:
[Tres Seaver]

- -1.  Python's 'hasattr' semantics are *broken by definition*, and will
never be fixed (because of backward compatibility).  Non-Zope Python
programmers will *not* expect or want exceptions raised from 'hasattr'.

As a local patch, this isn't too bad (one could even package it as a
do-nothing-after-initialization product).  However, no redistributed
product code should rely on the presence of a patched 'hasattr', but
should use the 3 argument getattr instead.

OTOH, defining & importing a utility function-- say, safehasattr()
--would make it all explicit.  That's what ZODB does.  I certainly
agree that changing the behavior of a builtin function by magic is at
best highly dubious practice.

In fact, consider this vetoed for the Zope core. :)


Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to