Zen of Python

Fredrik Lundh fredrik at pythonware.com
Sat Jan 22 08:26:00 EST 2005

Paul Rubin wrote:

>> > Some languages let you say things like:
>> >   for (var x = 0; x < 10; x++)
>> >      do_something(x);
>> > and that limits the scope of x to the for loop.
>> depending on the compiler version, compiler switches, IDE settings, etc.
> Huh?  I'm not sure what you're talking about.

guess you haven't used some languages that do this long enough.

in some early C++ compilers, the scope for "x" was limited to the scope
containing the for loop, not the for loop itself.  some commercial compilers
still default to that behaviour.


More information about the Python-list mailing list