On Fri, Sep 30, 2016 at 10:33 PM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > To me, "make for-loops be their own scope" sounds like a joke feature out of > joke languages like INTERCAL. I'm not aware of any sensible language that > does anything like this. > > No, wait a minute, I tell a lie, I recall Chris Angelico mentioning that one > of his favourite languages, Pike or REXX, does it. I forget which.
In C-like languages (including Pike), you can legally define a variable at any point, making it visible at that point and all inner locations - effectively, every brace becomes a new subscope. It makes sense ONLY because variables are declared, no matter where they are (globals are declared at module scope, locals at some kind of inner scope). So, it's not strictly true that Pike has for loops as their own scope, just that C-like languages have a lot of nested scopes. (REXX has nothing like this.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list