[Python-projects] Assertions, type checking, and testing
Nicolas Chauvat
nicolas.chauvat at logilab.fr
Thu Jun 22 14:23:55 CEST 2006
On Thu, Jun 22, 2006 at 02:20:32PM +0200, Aurélien Campéas wrote:
> 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 ...
did you mean `assert expr(*args, **kwargs)` ? :)
--
Nicolas Chauvat
logilab.fr - services en informatique avancée et gestion de connaissances
More information about the Python-Projects
mailing list