A counter-counter-proposal for PEP 236: #pragma( nested_scopes)

Warren Postma embed at geocities.com
Thu Mar 1 13:49:00 EST 2001


Has anyone considered borrowing a C notation:

#pragma( nested_scopes )

Benefits:
    - It's a comment therefore it doesn't break anything else.
    - It compiles fine and is ignored on pre-2.x systems.
    - More pragmas can be added later, for warnings, code generation,
etcetera.

Drawbacks:
    - It means a comment can be made to Do Something.  The express intent of
pragma
    is that it was the least evil means to accomplish the given purpose
though.

The comment nature might make it less egregious.  I can imagine other
#pragma stuff
if bytecode compilers for the Microsoft Net CLR and Jython compiler had code
generation options that needed to be taken into account.

I'm willing to attempt a patch if anybody else likes this idea.  The pragma
thing can be useful for other things as well.  As python grows, this
mechanism can be used instead of lots of other little cumulatively uglier
hacks.

Warren Postma






More information about the Python-list mailing list