Injecting new names into the above frame

Peter Waller peter.waller at
Sat Sep 13 13:35:29 CEST 2008

On Sep 12, 2:30 pm, Carsten Haese <carsten.ha... at> wrote:
> The answer to why this doesn't work lies in the disassembly of that
> function:

This makes me want to ask: is it difficult to modify a function's
code? Even if it weren't possible whilst the function was executing
(because then I would be returning to a function I just created, I
guess?) Could I make another function which converted this LOAD_GLOBAL

I agree that in general a function should have no side effects and I
would like to know exactly what it is going to do, and that what I'm
doing is unpythonic.

My curiosity extends because I would like to get to know a bit more
about python's internals. My gut tells me there has to be a way to
achieve what I'm after - even if it the result is extremely ugly.
Maybe it might involve applying a decorator to functions who use this
functionality, who change the code so that these calls work?

Cheers for your reply,

- Pete

More information about the Python-list mailing list