[Zope] python question

Jürgen Herrmann Juergen.Herrmann at XLhost.de
Fri Jul 1 11:10:58 EDT 2005


hi all!

i think there should be no functional difference in the two code snippets
below, but is there any difference in performance?
(i know, the "except AttributeError" could possibly mask an AttributeError
in the called function...)

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

2.:
try: o._before_transaction_commit()
except AttributeError: pass

regards, juergen herrmann
_______________________________________________________________________

>> XLhost.de - eXperts in Linux hosting <<

Juergen Herrmann
Weiherweg 10, 93051 Regensburg, Germany
Fon:  +49 (0)700 XLHOSTDE [0700 95467833]
Fax:  +49 (0)721 151 463027

ICQ:  27139974  -  IRC: #XLhost at quakenet
WEB:  http://www.XLhost.de


More information about the Zope mailing list