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