python: scope poop

Started by
1 comment, last by Daniel Miller 17 years, 11 months ago
Is it possible to set the value of a global object from inside a method without passing the object to the method?

i = 0
def f:
    i = 1
I want the 'i' in 'f' to be the global 'i'.
Advertisement
i = 0def f():    global i    i = 1
Thanks, that works perfectly.

This topic is closed to new replies.

Advertisement