Aahz <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
>  <[EMAIL PROTECTED]> wrote:
> >Aahz <[EMAIL PROTECTED]> wrote:
> >> In article <[EMAIL PROTECTED]>,
> >>  <[EMAIL PROTECTED]> wrote:
> >>>
> >>>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?
> >> 
> >> The advantage of the global singleton is that it is a container; 
> >> therefore, its contents are mutable and you don't need to keep using the 
> >> ``global`` statement.
> >
> >.... but you do keep having to use a longer reference to the value so
> >what have you won?
> 
> Clarity, simplicity, robustness

Clarity - why is it clearer?

Simplicity - no, you've added an extra layer.

Robustness - how?

-- 
Chris Green
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to