Functions that raise exceptions.

Alex G alexander.girman at gmail.com
Wed Jun 25 16:18:23 EDT 2008


whoops!  The code should be:

def decorator(arg):
    def raise_exception(fn):
        raise Exception
    return raise_exception

class some_class(object):
    @decorator('meaningless string')
    def some_method(self):
        print "An exception should be raised when I'm called, but not
when I'm defined"





More information about the Python-list mailing list