"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote

> Consider a data structure (say, an array) that is operated 
> on by a bunch of functions eg.
>
> def function_A
>     global array_G

> def function_B
>     global array_G

> etc...

> On the other hand, wiser heads say that the use of 'global' 
> is bad and that reworking the code into classes and objects 
> is better.

Rather than answer your question directly can I ask, do 
you know *why* wiser heads say global is bad? What 
problems does using global introduce? What problems 
does it solve?

> What do you think and suggest?

I think it's better to understand issues and make informed 
choices rather than following the rules of others.

I suggest you consider whether global is bad in this case 
and what other solutions might be used instead. Then make 
an informed choice. If, having researched the subject you 
don't understand why global is (sometimes) bad ask for 
more info here.

HTH (a little),

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to