Yet another decorator proposal

Marco Aschwanden PPNTWIMBXFFC at spammotel.com
Wed Aug 11 11:44:14 EDT 2004


On Wed, 11 Aug 2004 10:55:40 -0400, Christopher T King <squirrel at WPI.EDU> 
wrote:

> Also, don't forget docstrings get thrown away when using python -OO.
> Great voodoo would be needed to prevent this from happening.

<magic>
By now the compiler takes the first triple-quoted-string and sets it on 
the object's __doc__-var. Even in -00 mode the compiler has to find the 
triple-quoted-string... well on his way he can pick out the modifiers 
before throwing the doc string away, and set the appropiate object vars 
(__decorators__, __parameters__, ...).

Doesn't seem too complicated to me.
</magic>

Magic greetings,
Marco - The magician





More information about the Python-list mailing list