[Python-Dev] Re: Another approach to decorators.

David Abrahams dave at boost-consulting.com
Fri Aug 13 16:11:21 CEST 2004


Guido van Rossum <guido at python.org> writes:

>> > I think this is too far-fetched to consider as an alternative to the
>> > humble @decorator.
>> 
>> Maybe, but if you're still serious about improving support for
>> domain-specific embedded languages in Python you ought to give the
>> ideas another look.  If a reasonable syntax for decorators falls out
>> of a more general and useful mechanism, so much the better.
>
> How does
>
>     decorate <expr>, ...:
>        <block>
>
> improve support for domain-specific embedded languages?

I was thinking -- as well as I could through yesterday's allergy
attack -- more of the

      some-decorator:
          <block>

form, which allows people to create pseudo-statements of various
kinds.

Probably Bob I. is right that it doesn't help as much as it might if
<block> is executed before some-decorator is invoked.  That said,
maybe it's possible to pass the *code* for the block to
some-decorator in this scenario.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com



More information about the Python-Dev mailing list