PyMyth: Global variables are evil... WRONG!

Rick Johnson rantingrickjohnson at gmail.com
Wed Nov 13 21:25:58 EST 2013


On Wednesday, November 13, 2013 6:17:22 PM UTC-6, Tim Daneliuk wrote:
> > But python modules can't be interfaces because interfaces
> > should protect internal data, prevent external forces from
> > meddling with internal state (EXCEPT via the rules of a
> > predefined "contract"), hide dirty details from the caller,
> > and have clearly defined access points.
> >    BUT PYTHON MODULES DON'T FOLLOW THIS DESIGN PATTERN!
> I think this is an unfair criticism.   You can do this in
> ANY language if you know how.  For example, if I understand
> stack frames, I can write code that fiddles with local
> variables in compiled code.  For that matter, if I understand
> pointers at the assembler level, I can probably do the same
> with globals.

And if i understand file systems, and i have access to your
computer, i can delete the contents of your hard disc :-). We
can take this analogy all the way to it's absurd conclusions,
but we have not proven anything.

> Programming well has far less to do with the language and
> has far more to do with the designer and coder...

I very much agree. 



More information about the Python-list mailing list