1 Jul
2005
1 Jul
'05
3:38 p.m.
On 7/1/05, Jürgen Herrmann <Juergen.Herrmann@xlhost.de> 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