problem with variable scoping

Tim Peters tim_one at email.msn.com
Fri May 28 03:31:52 EDT 1999


[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 noted that 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>.

back-to-contemplating-orderly-ones-and-zeroes-ly y'rs  - tim






More information about the Python-list mailing list