[Tutor] Query - Where to put in global variables, if needed, as a good programming practice
Mark Lawrence
breamoreboy at yahoo.co.uk
Fri Jun 15 14:30:29 CEST 2012
On 15/06/2012 12:44, spawgi at gmail.com wrote:
> Hello,
>
> The point of good-bad-ness of global variables aside, if I needed to use
> them, which is a better place to put them.
> 1. In the __init__ function of a class? So they are available at the time
> an object is initialized or
> 2. In the actual function of the class where the variables are needed?
> Pros and Cons of either approach?
>
> Thanks and Regards,
> Sumod
>
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
I don't understand why you would need global variables, and then
promptly start discussing them wrt classes. Please explain what you are
trying to achieve and I'm certain that we'll come up with the best
solution for your use case.
--
Cheers.
Mark Lawrence.
More information about the Tutor
mailing list