Strange variable scope... is this right?
Aahz Maruch
aahz at panix.com
Wed Jan 17 17:30:19 EST 2001
In article <gcqp39.jkk.ln at 127.0.0.1>, <gradha at iname.com> wrote:
>
>In another attempt to DTW (Dominate The World), I wrote an obfuscated loop
>just to see the scope behaviour of Python:
>
>f = ["row", "cow", "arrow"]
>for f in f:
> print f
> for f in range (len (f)):
> print f
Since nobody else has suggested this, try a simple test:
f = ["row", "cow", "arrow"]
for f in f:
for f in range (len (f)):
print f
print f
--
--- Aahz (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
A house is a machine to keep your cat dry. --Aahz
More information about the Python-list
mailing list