On Tue, 12 Nov 2013 02:06:09 -0000, Rick Johnson
<rantingrickjohn...@gmail.com> wrote:
PyMyth: Global variables are evil... WRONG!
That's not a PyMyth. It's a CompSciMyth, or to be more accurate a good
general Software Engineering guideline regardless of language. Like all
guidelines it can be broken, but people who break it should do so
knowingly, aware that they have created potential problems for themselves.
============================================================
The denial of the 99%:
============================================================
Python has globals, but we just can't admit it!
A different subject entirely, but no more accurately stated.
[snip]
But even the "module level" globals can be accessed
"globally" if the module they are contained in is imported
everywhere.
Remember when I said that guidelines can be broken?
Globals are justified when they are used to communicate
information between scopes that otherwise were meant to be
mutually exclusive. One good example would be package sub-
modules.
Sometimes, yes. As long as you don't mind not being thread-safe, etc,
etc. If you've designed your interface, you're probably fine. If you've
throw it together with globals because it's the easy way, you're about to
find out why the guideline you're breaking is a good one.
"But Rick, even when we use globals, we don't need that many"
Only if you consider the single package that represents your
program, but what about the thousands of support libraries
with millions of lines of code that work in the background
to make your measly few thousand lines of code work? What
about all the globals that they have injected?
Didn't you just say that Python globals are really module-level globals?
Isn't this a strawman you've already disallowed? It sounds to me like
you're complaining that Python is ahead of the curve here :-)
--
Rhodri James *-* Wildebeest Herder to the Masses
--
https://mail.python.org/mailman/listinfo/python-list