[Python-ideas] Proposal for new-style decorators
Ethan Furman
ethan at stoneleaf.us
Tue Apr 26 19:58:31 CEST 2011
Daniel Stutzbach wrote:
> On Tue, Apr 26, 2011 at 10:10 AM, Christophe Schlick <cschlick at gmail.com
> <mailto:cschlick at gmail.com>> wrote:
>
> @decorator
> def new_style_repeat_fix(self, *args, **keys):
> """docstring for decorating function"""
> print "apply %r on %r" % (self.deco.__name__, self.func.__name__)
> for n in range(3): self.func(*args, **keys)
>
>
> I'm sure it's not exactly as you envisioned, but the decorator package
> provides roughly what you're describing:
>
> http://micheles.googlecode.com/hg/decorator/documentation.html#decorator-is-a-decorator
>
I believe he mentioned Michele's code in his first post.
I like the extra introspection Christophe's code offers.
Was there any syntax change beyond
@decorator
and
@decorator()
behaving the same?
~Ethan~
More information about the Python-ideas
mailing list