global declaration from within functions

Rob Andrews rob at jam.rr.com
Wed Aug 15 10:33:17 EDT 2001


I just posted this to the Python Tutor list, so please forgive the
cross-posting. I'm just academically curious about this.

*Learning Python* (pp. 99-105) points out that declaring globals from
within functions is possible, and shows how. I'm trying to think of
*why* one might want to declare or modify a global from within a
function.

A friend who knows quite a bit more than I do about the subject said:
"That's the first thing about python I've seen that really makes me go
"yecchhh.".  Global variables have to be declared outside the scope of
any functions or methods in almost every langauge except Perl."

stumped,
Rob
-- 
A {} is a terrible thing to waste.
Useless Python!
http://www.lowerstandard.com/python



More information about the Python-list mailing list