[Python-ideas] Decorations

Andrey Fedorov anfedorov at gmail.com
Tue Jul 14 00:29:55 CEST 2009


The terminology may very well be silly:

"naked" decorators don't expect parameters
"mixed" decorators should work both with parameters and without
"parametrized" decorators only work with parameters

Also consider using in functools.partial to convert your "parametrized"
> decorators.


Thanks, I'll try to incorporate that.

Cheers,
Andrey

On Mon, Jul 13, 2009 at 2:55 PM, Scott David Daniels
<Scott.Daniels at acm.org>wrote:

> Andrey Fedorov (should have written so as to avoid top-posting):
> > Daniel Stutzbach wrote:
> >
> >> Andrey Fedorov wrote:
> >>
> >>> ... It seems to me everything but line 5 "assert..." is cruft...
> >>> it makes sense to call that line the "decoration"....
> >>
> >> You might be interested in the decorator module, which similarly
> >>  tries toreduce the amount of boiler-plate code needed to build
> >> a decorator:
> >>     http://pypi.python.org/pypi/decorator
> >> (though it does not address exactly the same use case that you
> >> are addressing)
> >
>
>> Thanks for the pointer. One thing the decorator library doesn't solve is
>> abstracting the boiler of decorators that take parameters (and making it
>> simple to switch between "parametrized" decorators, "naked" decorators,
>> and
>> "mixed" decorators). Although it's certainly worth giving some thought to
>> and re-considering some of my internals.
>>
>
>
> Also consider using in functools.partial to convert your "parametrized"
> (or "mixed" decorators, I don't quite get your distinction) to "naked"
> decorators.
>
> --Scott David Daniels
> Scott.Daniels at Acm.Org
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090713/78a3075e/attachment.html>


More information about the Python-ideas mailing list