where is upvar

Harald Kirsch kirschh at lionbioscience.com
Wed Sep 20 07:54:39 EDT 2000


Harald Kirsch <kirschh at lionbioscience.com> writes:

> In Tcl there exists the possibility to create in a function an alias
> for a variable in the calling stack frame. The mechanism is
> 
>   upvar parentsVar myNameForParentsVariable
> 
> Every reference to myNameForParentsVariable in fact reads or writes the
> variable in the calling stack frame.

Seems like I found it already. I wonder if this is a typical python
idiom:

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

Harald Kirsch

-- 
----------------+------------------------------------------------------
Harald Kirsch   | kirschh at lionbioscience.com | We make the tools to
LION Bioscience | +49 6221 4038 172          | reverse engineer nature.
       *** Please: Never Ever Mail Me Copies Of Your Posts ***



More information about the Python-list mailing list