On 7/1/05, J├╝rgen Herrmann <[EMAIL PROTECTED]> wrote:
> i think there should be no functional difference in the two code snippets
> below, but is there any difference in performance?

Don't know, and don't care; these are (at the Python level)
functionally different.

> (i know, the "except AttributeError" could possibly mask an AttributeError
> in the called function...)

Exactly.  Shouldn't be a real issue in a released version, but better
safe than sorry.

> 1.:
> hook = getattr(o, '_before_transaction_commit', None)
> if hook: hook()

Better yet:

 hook = getattr(o, '_before_transaction_commit', None)
 if hook is not None: hook()


Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation
Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to