On 2013-08-22 13:36, Matthew Ngaha wrote:
> I'm always told to avoid using them. I read discussions on the python
> irc channel about them but honestly i feel there are some times where
> i can't avoid using them. Like where i want to keep track of a state
> variable in many different functions that may or may not alter its
> value and also not wanting any of the functions to return it to the
> caller.

It sounds like you want to use a class.

> My question is how many global variables did your last decent sized
> program have? Also please share any insight you have about them. I do
> try to avoid them, but is this always possible?

I don't have any global variables in any of my projects, and I've been
programming Python in some capacity for almost 8 years now. Why would you not
just use a class if you want to store state?

Attachment: pgp8g3wmh7NcT.pgp
Description: PGP signature

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to