> I was practicing how to use a global counter and trying to understand > how functions can interact with each other. I can understand if I can > see the error's when I run the program. I know my terminology may be > hard to follow. Also I like your book :)
you are well read since you already have seen places where it is suggested that using sys.exit() is not the best choice. as alan has said, there isn't anything really "evil" about it... it just not necessary, and you can write applications without using it at all. another thing you'll read about is how it's "not good" to have global variables. as with sys.exit() it is possible to have a universal counter without using a global variable. they are a bit worse than sys.exit() because they take up extra memory, there is less control -- they can be updated in multiple places in an application; such access may result in race conditions and unexpected behavior if modified by concurrent threads, etc. to find a suitable replacement will depend on what you're counting, and where a better place may be to store the counter. for example, you can use a static member of a class, a closure, etc. if you have specific application requirements, just post them to the list, and folks will be glad to help you get around using global counters. glad you enjoy the book! pssst... there is a DVD version of it coming out at the end of this month called "Python Fundamentals"... keep an eye out for it! ;-) best regards, -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall, (c)2007,2001 "Python Fundamentals", Prentice Hall, (c)2009 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor