decorator with ```

Sean Ross sross at connectmail.carleton.ca
Thu Aug 12 07:58:53 EDT 2004


"Sean Ross" <sross at connectmail.carleton.ca> wrote in message
news:0zISc.18837$a65.823987 at news20.bellglobal.com...
[snip]
> def makeDecoratorSyntax(spec=None):
>     ```"""  Factory for new decorator syntaxes.
>
>          Keeps all proposals in a list and will recombine
>           them at random if called without a spec.
>         """
>     this = staticmethod(this)      # <- transformation explicit
>     this.author = "somebody"    # <- add attributes normally
>     ```
>     raise NotImplementedException()
[snip]

It would work something like this:

def triplebacktick(this, transform):
    this.doc = transform.doc
    return transform(this)

def transform(f):
    """  Factory for new decorator syntaxes.

          Keeps all proposals in a list and will recombine
          them at random if called without a spec.
    """
    f = staticmethod(f)
    f.author = "somebody"
    return f

def makeDecoratorSyntax(spec=None):
    raise NotImplementedException()

makeDecoratorSyntax = triplebacktick(makeDecoratorSyntax, transform)






More information about the Python-list mailing list