using execfile() in class/instance methods
Wayne Cuddy
wcuddy at lserv.ja10629.home
Fri Dec 8 18:12:25 EST 2000
I am attempting to use the execfile() function to "source" a file that
has valid python code to create a diction object:
bn { 'key' : 'value1',
'key2' : 'value2' }
I am issueing this command from a class constructor method and would
like bn to be bound the class instance. So in the future I can say:
print self.bn['key']
Is this possible? I assume I am screwing up the global() and locals()
arguments to the function which I can say that I don't fully
understand. Also is there another better/worse way to do this???just
so I can see what else is out there..
Thanks in advance,
Wayne
More information about the Python-list
mailing list