[Python-projects] Assertions, type checking, and testing
Aurélien Campéas
aurelien.campeas at logilab.fr
Thu Jun 22 14:20:32 CEST 2006
On Thu, Jun 22, 2006 at 02:14:50PM +0200, Nicolas Chauvat wrote:
> > def assert_expr(expr):
> > if ASSERT_EXPR:
> > assert expr()
>
> Did you mean `assert callable(expr)` ?
I meant :
def assert_expr(expr, *args, **kwargs):
if ASSERT_EXPR: assert expr(args, kwargs)
whose usage is even more clunky :
assert_expr(lambda foo, bar: something_about(foo, bar), foo, bar)
but now has some meaning. This is not too dry ...
>
> --
> Nicolas Chauvat
>
> logilab.fr - services en informatique avancée et gestion de connaissances
>
More information about the Python-Projects
mailing list