Issue 2962: Goodbye, 'global' statement! (original) (raw)
Issue2962
Created on 2008-05-25 06:54 by chester, last changed 2022-04-11 14:56 by admin. 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) * ![]() |
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 |
2022-04-11 14:56:34 | admin | set | github: 47211 |
2008-05-25 08:01:10 | georg.brandl | set | status: open -> closedresolution: rejectedmessages: + nosy: + georg.brandl |
2008-05-25 06:54:35 | chester | create |