What are decorators?

Heiko Wundram heikowu at ceosg.de
Mon Aug 9 14:51:12 EDT 2004


I forgot to append the actual output from the two examples.

The first example (func_spec) outputs:

heiko at d168 ~ $ python2.4 test.py
y's author and version: Heiko Wundram 0.1
z's author and version: Somebody else 0.2
Authors, and functions by authors: {'Somebody else': 1, 'Heiko Wundram': 1}
Calling y.
Calling z.
heiko at d168 ~ $

And the second example (debugger) outputs:

heiko at d168 ~ $ python2.4 test3.py
---- DEBUGGER STARTS HERE ----
Entering: y
Arguments: (<__main__.x object at 0xb7bff2cc>,)
Keyword arguments: {}
Running function...
Function returned: (42, 'the answer to everything')
Leaving: y
---- DEBUGGER ENDS HERE ----
---- DEBUGGER STARTS HERE ----
Entering: y
Arguments: (<__main__.x object at 0xb7bff2cc>, True)
Keyword arguments: {}
Running function...
Running function raised exception.
Traceback (most recent call last):
  File "test3.py", line 14, in debugf
    retv = f(*args,**kwargs)
  File "test3.py", line 31, in y
    raise Exception, "We raise an exception here."
Exception: We raise an exception here.
Leaving: y
---- DEBUGGER ENDS HERE ----
Traceback (most recent call last):
  File "test3.py", line 39, in ?
    ob.y(True)
  File "test3.py", line 14, in debugf
    retv = f(*args,**kwargs)
  File "test3.py", line 31, in y
    raise Exception, "We raise an exception here."
Exception: We raise an exception here.
heiko at d168 ~ $

HTH!

Heiko.



More information about the Python-list mailing list