Python Gotcha's?
Cameron Simpson
cs at zip.com.au
Wed Apr 4 19:21:21 EDT 2012
On 04Apr2012 23:07, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
| If you decorate a function, by default the docstring is lost.
|
| @decorate
| def spam(x, y):
| """blah blah blah blah"""
|
| spam.__doc__ => raises exception
|
| Solution: make sure your decorator uses functools.wraps().
There's a functools.wraps()? [*smacks forehead with palm*] Thanks.
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
A pessimist is an optimist in full possession of the facts.
More information about the Python-list
mailing list