Eric Snow wrote:
...
One work-around I found is the following change in example:
test1.py
++++++++++++++++++++++++++++
def decorator(function):
    def new_function(*args, **kwargs):
        return function(*args, **kwargs)
    new_function.__module__ = function.__module__
    new_function.__doc__ = function.__doc__
    new_function.__name__ = function.__name__
    return new_function

However, this seems pretty lame.  The doctest module should be able to
figure out that the docstring belongs is there in the module.

would the following look better?
    import functools
    ...

    def decorator(function):
        @functools.wraps(function)
        def new_function(*args, **kwargs):
            return function(*args, **kwargs)
        return new_function

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to