[Python-Dev] defmacro (was: Anonymous blocks)
p.f.moore at gmail.com
Mon Apr 25 20:06:24 CEST 2005
On 4/25/05, Michael Chermside <mcherm at mcherm.com> wrote:
> I've been following this conversation, and it sounds to me as if we
> are stumbling about in the dark, trying to feel our way toward something
> very useful and powerful. I think Jim is right, what we're feeling our
> way toward is macros.
I think the key difference with macros is that they act at compile
time, not at run time. There is no intention here to provide any form
of compile-time processing, and that makes all the difference.
What I feel is the key concept here is that of "injecting" code into a
template form (try...finally, or try..except..else, or whatever) .
This is "traditionally" handled by macros, and I see it as a *good*
sign, that the discussion has centred around runtime mechanisms rather
than compile-time ones.
 Specifically, cases where functions aren't enough. If I try to
characterise precisely what those cases are, all I can come up with is
"when the code being injected needs to run in the current scope, not
in the scope of a template function". Is that right?
More information about the Python-Dev