Created
August 16, 2010 16:31
-
-
Save cbarrett/527232 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% cat main.py | |
from config import config, set_config, print_config | |
print "1: %s" % (config) | |
set_config({'hello': 'world'}) | |
print "3: %s" % (config) | |
print_config() | |
% cat config.py | |
config = None | |
def set_config(new_config): | |
global config | |
config = new_config | |
print "2: %s" % config | |
def print_config(): | |
print "4: %s" % config | |
% python main.py | |
1: None | |
2: {'hello': 'world'} | |
3: None | |
4: {'hello': 'world'} | |
Line 3 above should be {'hello': 'world'}. I have no idea why it's not. Anyone know? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just to be clear, I do not want to write:
I want to just be able to write
config
and have it work. Thanks to Dan I think I at least know what the problem is now. :)