[triangle-zpug] scope in nested function calls
Joseph Mack NA3T
jmack at wm7d.net
Sun May 11 22:21:57 UTC 2008
On Sun, 11 May 2008, Philip Semanchuk wrote:
& thanks Bob too
It seems I have to declare the variable global at least at
the module level
> #! /usr/bin/python
> # The line below will be executed once when the module is initialized.
> This should print (untested):
> foo: bar_value 42
> bar: bar_value 1
> foo: bar_value 1
As for the term "nesting" - I was using it in the sense that
fnA() calls fnB(), then anything declared in fnA() should be
visible to fnB(). At least that was my understanding from a
long time ago. However looking in google for "wiki" and
"nesting", I find the term nesting is used only for
recursive calls by a fn() to itself. I have no idea whether
I missunderstood nesting when I first heard it, or the
meaning has changed over 40yrs.
Writing a fn() inside another fn() apparently is called
enclosing in python, although nesting would seem to be a
reasonable term for it.
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!
More information about the triangle-zpug