[Zope] python question
Fred Drake
fdrake at gmail.com
Fri Jul 1 11:38:37 EDT 2005
On 7/1/05, Jürgen Herrmann <Juergen.Herrmann at 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
More information about the Zope
mailing list