N00b question on Py modules

Ant antroy at gmail.com
Wed May 9 11:06:23 EDT 2007


On May 9, 2:47 pm, Sion Arrowsmith <s... at chiark.greenend.org.uk>
wrote:
...
> How so? Python style gurus discourage use of global variables. So
> does all the C++ (and to a lesser extent C) advice I've ever
> encountered. And Java outright forbids the concept.

Class variables (public static), are the equivalent of global
variables in Java, and can be an equal pain. Singleton objects can
cause similar problems, since they are essentially global objects, and
changing the values of any of their members can cause wierd behaviour
in otherwise unrelated parts of the code. So Java isn't by any means
immune to the global variable problem, it just has different names for
them!





More information about the Python-list mailing list