How do I modify my callers local variables?
tjreedy at udel.edu
Tue Feb 13 03:57:50 CET 2001
> def parse_keywords(defaults,kw):
> import sys
> raise None
> frame = sys.exc_info().tb_frame.f_back
This only gives you a PyDict copy of the function locals, which happen to
be internally implemented as an indexed C array.
> for i in defaults.keys():
> except KeyError:
Modifying your PyDict copy has no effect on the internal C array that the
function actually uses. Thus this assignment in useless in terms of what
you hope to accomplish.
> I'd really appreciate any insights into this matter.
I hope this helps.
Terry J. Reedy
More information about the Python-list