PyMyth: Global variables are evil... WRONG!

Chris Angelico rosuav at gmail.com
Tue Nov 12 10:22:20 EST 2013


On Wed, Nov 13, 2013 at 1:32 AM, Alister <alister.ware at ntlworld.com> wrote:
> As an analogy music has may general rules that musicians are wise to
> follow.
> Some pieces of music that break these rules are great because they have
> broken the rules but most are not. those that are great are great because
> the musician in question understands the reasons for the rules & how
> breaking them will affect the end product, the ones that are bad are
> because the musician does not know enough about music to even know the
> rule exists.

Agreed. Pieces of music that violate the rules arbitrarily are just
annoying to try to play (and nearly impossible for the church to
follow), but when you find those really brilliant pieces that do
something special (Sir Arthur Sullivan, I'm looking at you -
especially having just been reading the booklet that came with the new
Beauty Stone recording), it's magnificent.

Global variables basically don't exist in Python. You have per-module
state. And if you start monkey-patching, you're fiddling with someone
else's module. It's all fun and games till someone loses a function...

sys.stdout.write=None

ChrisA



More information about the Python-list mailing list