Python handles globals badly.

tdev at tdev at
Wed Sep 2 20:47:44 CEST 2015

I agree with Skybuck Flying. 
I am aware if a var is a module function var or a module global var.
If I want read or write a global var.

Using the keyword global inside each(!) function only 
to mark the global var writeable in each of the functions
is really an over-regulation and very annoying from my point of view.

Especially cause a module is a singleton.
And globals are only module aware vars.
Even Java (type-safe language) need not such things for its static or member vars.
I have disliked this already in PHP where one has to do
exact the same thing as in Python (and hoped Python does it better, but not).
And using an import here is no solution, cause this is
something which relates only to the scope and state of a module itself. 

I therefore would like to see a PEP which allows also writing 
global module vars inside module functions without the need 
for explicit setting the keyword "global" in more or less each(!) 
module function as the first line of code.

I hope a lot can/will agree and a new PEP will arise
to give this small responsibility back to the developer.


More information about the Python-list mailing list