KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I was somehow surprised by the following behavior: def main(): print "%s" % foo if __name__ == "__main__": foo = "bar" main() i.e. a module function has access to enclosing variables in the __main__ . What's the explanation for it?
Tags (comma-separated)
Save Edits
Cancel