classification
Title: Goodbye, 'global' statement!
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: chester, georg.brandl
Priority: normal Keywords:

Created on 2008-05-25 06:54 by chester, last changed 2008-05-25 08:01 by georg.brandl. This issue is now closed.

Messages (2)
msg67322 - (view) Author: Chester (chester) Date: 2008-05-25 06:54
The 'global' statement is used to mark a variable as global. It is
used in functions to allow statements in the function body to rebind
global variables. Using the 'global' statement is generally
considered poor style and should be avoided whenever possible.
    Example:

count = 1
def inc():
    global count
    count = count + 1


Since the use of the 'global' statement is frowned upon, it should be
removed from Python 3.0.
msg67326 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-25 08:01
First, global is frowned upon in large projects, but sometimes useful in
quick & dirty scripts.

Second, the time for such changes to Python 3.0 is past.

Third, this at least needs a PEP.
History
Date User Action Args
2008-05-25 08:01:10georg.brandlsetstatus: open -> closed
resolution: rejected
messages: + msg67326
nosy: + georg.brandl
2008-05-25 06:54:35chestercreate