where is upvar

Jake Baker jbaker at ummelec.com
Wed Sep 20 12:37:28 EDT 2000


Harald Kirsch wrote:

> def bla(someparams, upvars=local())
> upvars['parentsVar'] = "some value set in parent stack frame"

And then later wrote:

> Not if it is documented and if the sole purpose of a certain function
> is to do that in a defined way.

If that is your desire, require the caller to pass you his local():

def bla ( params, upvars):
    "Please pass your local() to upvars when calling this function."

(Although my suspicion is that that's not what you want to do - try to rethink the problem using Pythons powerful abilities rather than trying to fit Python code to what is arguably a cludge in Tcl. If you explain your problem, perhaps someone on the list can suggest a better way of solving it.)




More information about the Python-list mailing list