[Python-Dev] Call for defense of @decorators

"Martin v. Löwis" martin at v.loewis.de
Thu Aug 5 22:53:28 CEST 2004


Chris King wrote:
> Isn't this more a use case for function attributes, rather than
> decorators?  Decorators seem like overkill in this case.

I don't fully understand the issues, but I believe that the
declaration is more like a statement than a mere declaration
(very similar to all other "declarations" in Python).

In the specific case, I believe declaring the Objective-C
signature also performs some kind of registration of the
function with the Objective-C run-time. This cannot be done
with function attributes; you would still need to invoke
a do_register()/generate_wrappers() functions at some point.

Even if this is a mere declaration, function attributes would
harm readability: they would have to go after the function, whereas
you want the Objective-C signature close to the Python signature.

Regards,
Martin


More information about the Python-Dev mailing list