The rules of reference

Jeff Epler jepler at
Thu Oct 31 20:45:05 CET 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's 'if __name__ == "__main__":' block, it changes __main__.num, and
still doesn't change a.num.


More information about the Python-list mailing list