[Python-ideas] Proposal for new-style decorators

Christophe Schlick cschlick at gmail.com
Wed Apr 27 05:02:07 CEST 2011


On Wed, Apr 27, 2011 at 4:44 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:

> In the standard approach, I see "test(*args, **keys)" and go "!@#$%
> Name your !@#$% arguments, for heaven's sake!" and go read the code
> (the first time), or "oh, it's decorated, gotta read the code, I guess
> ... mmrmfrmblgrr" (with experience).  But the help's less-than-
> informative signature tells me I need to review carefully, whereas in
> your approach I would tend to leave it up to the compiler to some
> extent.

I ma not sure to understand the problem. In my approach, you get:

>>>help test
<function <deco>test(*args, **keys)>

then you say, "oh, it's decorated', let's see more..."

>>> help test.func                     # that's the undecorated function
<function test(first=0, last=0)>

Not only, you've got the clear information that the function is
decorate (by the '<deco>' prefix) but also you get a standard and
immediate solution to get the right signature: help(test.func)

I do not understand why this is worse that the <function test(*args,
**keys)> answer provided by the '@wraps' function ?

CS



More information about the Python-ideas mailing list