Assigning to global variables from within a function
by Psymaster other posts by this author
Jul 12 2003 8:18PM messages near this date
Re: [OFF TOPIC] Re: The "intellectual property" misnomer
|
Re: Assigning to global variables from within a function
I want to do this:
int= 0
def change_int():
int += 1
change_int()
but of course it doesn't work, Python thinks it is a local
variable and refuses to reference the global one. So what would
be a good way of doing this. Note that creating a new global
variable from within the function isn't convenient because the
function is intended to be used in loops.
--
http://mail.python.org/mailman/listinfo/python-list
Thread:
Psymaster
Irmen de Jong
Psymaster
Tom Plunket
W Isaac Carroll
|