Can someone explain this behavior to me?

Jesse Aldridge JesseAldridge at
Thu Feb 26 16:48:08 EST 2009

I have one module called
class Foo:
    foo = None

def get_foo():

if __name__ == "__main__":
    import bar = "foo"
And another one called
import foo

def go():
    assert foo.get_foo() == "foo"
When I run, the assertion in fails.  Why?

More information about the Python-list mailing list