The rules of reference

Jeff Epler jepler at unpythonic.net
Thu Oct 31 14:45:05 EST 2002


But running 'from a import *' is like writing
    import a
    num = a.num
    print_num = a.print_num
    # [ and so on for every item in a]
    del a
so you still have two different things named num.  One of them is still
__main__.num, and the other is a.num.  When you execute "num = 60" in
a.py's 'if __name__ == "__main__":' block, it changes __main__.num, and
still doesn't change a.num.

Jeff




More information about the Python-list mailing list