Hi,<br><br>I have a small test program written trying to set up a dictionary that points keys to functions.  It is working.  However, in the process of creating it I noticed a weird problem.  The problem is that this IS WORKING and I think it shouldn't be.<br>
<br>~ Here is the input config file code ~  its called config.file and is referenced from the script.<br><br><span style="color: rgb(51, 51, 255);">[MAPS]</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">relmap = 1</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">posmap = 1</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">asnmap = 1</span><br><br>~ Here is the code that is working but I feel that it shouldn't be ~<br>
<br><span style="color: rgb(51, 51, 255);">import ConfigParser</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">config = ConfigParser.ConfigParser()</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">config.read("config.file")</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">sections = config.sections()</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">print config.options('MAPS')</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">def posmap():</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">    print "posmap function"</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">def relmap():</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">    print "relmap function"</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">def asnmap():</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">    print "asnmap function"</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">for value in config.options('MAPS'):</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">    value</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">map_library = {</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">               'posmap': posmap()</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">              ,'relmap': relmap()</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">              ,'asnmap': asnmap()</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">              }</span><br><br>~ Output ~<br><br>['posmap', 'relmap', 'asnmap']<br>posmap function<br>relmap function<br>asnmap function<br><br>~ The reason I'm confused is because when I change the code (Take away the map_library dictionary)<br>
<br><span style="color: rgb(51, 51, 255);">import ConfigParser</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
config = ConfigParser.ConfigParser()</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
config.read("config.file")</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
sections = config.sections()</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
print config.options('MAPS')</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
def posmap():</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
    print "posmap function"</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
def relmap():</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
    print "relmap function"</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
def asnmap():</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
    print "asnmap function"</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
for value in config.options('MAPS'):</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">
    value</span><br><br>~ The output is the following ~<br><br>['posmap', 'relmap', 'asnmap']<br><br>Is this defaulting to the dictionary and making it work?  In the first set of code I don't reference the map at all but it still seems to know where to look?  I am considerably new to Python<br>
<br><br>