15 May 17:13
Re: Pre-commit hooks
From: Yannick Gingras <ygingras <at> ygingras.net>
Subject: Re: Pre-commit hooks
Newsgroups: gmane.comp.python.sqlalchemy.user
Date: 2008-05-15 15:13:25 GMT
Subject: Re: Pre-commit hooks
Newsgroups: gmane.comp.python.sqlalchemy.user
Date: 2008-05-15 15:13:25 GMT
az <at> svilendobrev.com writes: > speed wise, this is better: hasattr is implemented as getattr + try > except. i would do it even: > f = getattr(instance, "_pre_insert", None) > if f: f() > Thus the func name is spelled only once - avoids stupid mistakes. Spelling only once is the killer feature of your approach. I just refactored my implementation. Thanks! -- -- Yannick Gingras --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy <at> googlegroups.com To unsubscribe from this group, send email to sqlalchemy-unsubscribe <at> googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
RSS Feed