| Home | Trees | Indices | Help |
|
|---|
|
|
Decorator module by Michele Simionato <michelesimionato@libero.it> Copyright Michele Simionato, distributed under the terms of the BSD License (see below). http://www.phyast.pitt.edu/~micheles/python/documentation.html
Included in NLTK for its support of a nice memoization decorator.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
old_sys_path =
|
|||
p =
|
|||
|
|||
|
|
General purpose decorator factory: takes a caller function as input and returns a decorator with the same attributes. A caller function is any function like this:
def caller(func, *args, **kw):
# do something
return func(*args, **kw)
Here is an example of usage: >>> @decorator ... def chatty(f, *args, **kw): ... print "Calling %r" % f.__name__ ... return f(*args, **kw) >>> chatty.__name__ 'chatty' >>> @chatty ... def f(): pass ... >>> f() Calling 'f' decorator can also take in input a class with a .caller method; in this case it converts the class into a factory of callable decorator objects. See the documentation for an example. |
|
|
|||
old_sys_path
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Apr 11 14:39:41 2011 | http://epydoc.sourceforge.net |