On Thu, 2008-08-07 at 20:08 +0200, Dirk Meyer wrote:
> Only for epydoc? Wouldn't it be easier to just not set the decorator
> for epydoc instead of running a decorator in a decorator?

I have no idea what you mean here.

epydoc uses introspection to create the documentation.  Part of that
introspection is examining the function signatures, so it shows the
signature in the documentation.

When you use a decorator, you hide the signature from epydoc:

        def somedec(func):
           def newfunc(*args, **kwargs):
              func(*args, **kwargs)
           return newfunc
        
        
        @somedec
        def foo(a, b, c=42):
           pass

When epydoc generates documentation for that, you'd like to see the
signature for foo, that is (a, b, c=42).  Instead what you'll see is
(*args, **kwargs) because the epydoc sees the decorated function, not
the underlying function (of course).

The new wrap decorator preserves the function signature, so newfunc has
the same signature as func, and the documentation is more sensible.




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to