[Python-ideas] Proposal for new-style decorators

Chris Rebert pyideas at rebertia.com
Wed Apr 27 00:39:16 CEST 2011


On Tue, Apr 26, 2011 at 10:11 AM, Christophe Schlick <cschlick at gmail.com> wrote:
> Part 3 - Implementation and additional remarks/questions
<snip>
> Here is the code, so that you can experiment with it, if you wish:
>
> #---
> class decorator(object):
>  """apply a 'new-style' decorator to a function"""
>  def __init__(self, deco=None, **keys):
>    # either get reference or default parameters for decorating function
>    self.deco = deco; self.keys = keys; self.stack = list()
>  def __call__(self, func=None, **keys):

(Somewhat contrived): What if my decorator or the decorate-ee has a
parameter named `deco` or `func`?

Cheers,
Chris



More information about the Python-ideas mailing list