Python handles globals badly.

MRAB python at mrabarnett.plus.com
Wed Sep 2 22:22:08 CEST 2015


On 2015-09-02 21:08, Sven R. Kunze wrote:
> On 02.09.2015 20:47, tdev at freenet.de wrote:
>> 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.
>
> It reflects the collective experience of programmers, computer
> scientists, and so forth of the last decades.
>
>
> Globals are evil. Stay away from them.
>
I think it's like that sometimes-misquoted saying "money is the root of 
all evil".

It's "the love of money is the root of all evil".

Similarly, it's the love (or misuse or overuse) of globals that's evil,
IMHO.



More information about the Python-list mailing list