[Python-Dev] Call for defense of @decorators

Neil Schemenauer nas at arctrix.com
Thu Aug 5 21:45:23 CEST 2004


On Thu, Aug 05, 2004 at 09:28:13PM +0200, Ronald Oussoren wrote:
> On 5-aug-04, at 21:17, Gustavo Niemeyer wrote:
> >   def funcname(...):
> >      ...
> >   funcname.signature = "v@:@i"
> 
> That should be workable for this specific example.

Even nicer if '_' is bound to the last function defined.

    class SomeClass(objc):
        def funcname(...):
           ...
        _.signature = "v@:@i"

The objc metaclass could take the 'signature' function attribute and
transform the function.

> It wouldn't work for the objc.accessor example. The objc.accessor
> function/decorator deduces the right kind of signature from the
> name and arguments of the function.

Can't the metaclass do that?

  Neil


More information about the Python-Dev mailing list