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/2002-April/022080.html below:

[Python-Dev] restrictions on global statement

[Python-Dev] restrictions on global statement [Python-Dev] restrictions on global statementJeremy Hylton jeremy@alum.mit.edu
Mon, 01 Apr 2002 16:24:53 -0500 (EST)
The lang ref says:

    Names listed in a \keyword{global} statement must not be defined
    as formal parameters or in a \keyword{for} loop control target,
    \keyword{class} definition, function definition, or
    \keyword{import} statement.

    (The current implementation does not enforce the latter two
    restrictions, but programs should not abuse this freedom, as
    future implementations may enforce them or silently change the
    meaning of the program.)

While this is all technically correct, the second paragraph is a bit
misleading.  The only case enforced by the compiler is that a formal
parameter can't be declared global.

Do we actually care about this rule?  The lang ref would be shorter if
it were silent on the issue, and it would more closely describe the
way Python has behaved as long as I've been using it.

Jeremy




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