A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/056721.html below:

[Python-Dev] Visibility scope for "for/while/if" statements

[Python-Dev] Visibility scope for "for/while/if" statements [Python-Dev] Visibility scope for "for/while/if" statementsAndrew Koenig ark at acm.org
Fri Sep 23 15:45:45 CEST 2005
> 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?



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4