"Roman Suzi" <rn*@onego.ru> wrote in message
news:ma**************************************@pyth on.org...
One more crazy syntax before-def but which could be treated
more generally:
```""" Factory for new decorator syntaxes.
Keeps all proposals in a list and will recombine
them at random if called without a spec. """
staticmethod```
def makeDecoratorSyntax(spec=None):
raise NotImplementedException()
New execution block type (in addition to exec, eval and
interactive) could be added to allow needed behaviour.
[snip]
I think it would be interesting if triple-back-ticks could be used to
introduce a kind of meta-scope, using 'this' to refer to the namespace being
operated upon (so you wouldn't have to spell out the object's name all the
time). For example:
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()
This idea could be used to do transformations on classes and modules as
well.