[Python-Dev] Visibility scope for "for/while/if" statements
Andrew Koenig
ark at acm.org
Fri Sep 23 15:45:45 CEST 2005
More information about the Python-Dev mailing list
Fri Sep 23 15:45:45 CEST 2005
- Previous message: [Python-Dev] Visibility scope for "for/while/if" statements
- Next message: [Python-Dev] Visibility scope for "for/while/if" statements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Interestingly enough, not all C++ compilers (Microsoft) hid variables > created in for loops > (http://www.devx.com/cplus/10MinuteSolution/28908/0/page/2). That's because the C++ spec changed during standardization, when the standards committee realized the original idea was a mistake. One of the convincing cases: if (x) for (int i = 0; i != 10; ++i) { } Is I in scope after the if statement? If so, what value does it have if x is false? If not, then apparently the subject of an "if" statement is a scope...so why can't I write this? if (x) int i = 42; and have i go out of scope?
- Previous message: [Python-Dev] Visibility scope for "for/while/if" statements
- Next message: [Python-Dev] Visibility scope for "for/while/if" statements
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list