problem with variable scoping
Moshe Zadka
moshez at math.huji.ac.il
Fri May 28 15:43:22 EDT 1999
On Fri, 28 May 1999, Tim Peters wrote:
> [Moshe Zadka]
> > ...
> > The Python code shadows last_line_empty only *after* the "decleration"
>
> Since this has been beaten to death by others already, and bots never ever
> waste so much as the hint of a shadow of an unneeded word let alone an
> entire sentence or-- dear Lord! --an entire post, just noting that this
> misconception is rampant among Python newcomers. It seems to be coupled
> with the belief that binding a name in a function somehow "creates" a local
> vrbl of that name. Guido long ago notedthat Python has static scoping and
> dynamic typing, while Perl (at the time) had dynamic scoping and static
> typing (of the "$", "@", "&", "%" variety). Strangely enough, though, the
> people who assume Python has dynamic scoping usually come from a C
> background instead of a Perl one! This is too much human inconsistency for
> a bot to address <wink>.
Well, as I understand (and at least want) static scoping, it implies the
full power of closures -- i.e., more then the ``two name spaces'' paradigm
of Python. I think the problem Python doesn't have a true Scheme-ish
define, and '=' (i.e., Python's set!) implies define in strange ways
(i.e., the one I did not expect: set! anywhere in the body implies a
define, unless there is the global keyword. Did I get that right?)
still-waiting-for-arbitary-expressions-in-lambdas-and-tail-call-optimization-
which-is-possible-in-python-ly y'rs, Z.
--
Moshe Zadka <mzadka at geocities.com>.
QOTD: My own exit is more likely to be horizontal then perpendicular.
More information about the Python-list
mailing list