Globals or objects?
- From: MartinRinehart@xxxxxxxxx
- Date: Thu, 21 Feb 2008 04:16:04 -0800 (PST)
I had a global variable holding a count. One source Google found
suggested that I wouldn't need the global if I used an object. So I
created a Singleton class that now holds the former global as an
instance attribute. Bye, bye, global.
But later I thought about it. I cannot see a single advantage to the
object approach. Am I missing something? Or was the original global a
better, cleaner solution to the "I need a value I can read/write from
several places" problem?
.
- Follow-Ups:
- Re: Globals or objects?
- From: Duncan Booth
- Re: Globals or objects?
- From: Aahz
- Re: Globals or objects?
- From: Steve Holden
- Re: Globals or objects?
- Prev by Date: Re: Linux/Python Issues
- Next by Date: Re: usenet problem
- Previous by thread: newbie in python
- Next by thread: Re: Globals or objects?
- Index(es):