No macros in Python

Courageous jkraska at san.rr.com
Sun Dec 15 19:35:15 EST 2002


>Hmm, that's called "unhygienic macros" and is widely considered a bad
>idea. 

I know what unhygienic macros are. One way around this flaw might be
to create a context in which the enclosing namespace is made available
but not the default. This would allow a specific and deliberate
manipulation of the enclosing namespace, but avoid accidental ones.
I'm just sort of thinking out loud here.

Of course, for all I know, there's a way to grab the stack and get
the invokers locals already, if you really insist on this. Is there?

C//

p.s. the other problem you talked about could be solved by something
that looks like a function invocation, but is actually a lexical
closure around the variables being "passed" to the "function". This
would require being able to determine at invocation time what type
the target was: a real function, or this other thing.





More information about the Python-list mailing list