This one has me mystified good!
This works (print statement is executed as the Exception is caught) as
advertised:
try:
raise AssertionError
except AssertionError:
print "caught AssertionError"
But this one does not:
def test():
raise AssertionError
try:
Hi all, I have a question about decorators. I would like to use them
for argument checking, and pre/post conditions. However, I don't want
the additional overhead when I run in non-debug mode. I could do
something like this, using a simple trace example.
@decorator
def pass_decorator(f, *args, **
On Mar 29, 6:34 pm, MRAB wrote:
> LX wrote:
> > Hi all, I have a question about decorators. I would like to use them
> > for argument checking, and pre/post conditions. However, I don't want
> > the additional overhead when I run in non-debug mode. I could do
> &
On Mar 29, 7:11 pm, Steven D'Aprano
wrote:
> On Mon, 29 Mar 2010 17:54:26 -0700, LX wrote:
> > Hi all, I have a question about decorators. I would like to use them for
> > argument checking, and pre/post conditions. However, I don't want the
> > additional overhead
On Mar 30, 2:41 pm, MRAB wrote:
> LX wrote:
> > On Mar 29, 6:34 pm, MRAB wrote:
> >> LX wrote:
> >>> Hi all, I have a question about decorators. I would like to use them
> >>> for argument checking, and pre/post conditions. However, I don't want
On Mar 31, 2:28 pm, Stephen Hansen wrote:
> On 2010-03-31 13:59:01 -0700, LX said:
>
>
>
>
>
> >> pass_decorator will be called when the decorated function is _defined_,
> >> but not when the decorated function is _called_.
>
> > Why is it then t