Loading a file only once into an object and being able to access it from other modules - still have a problem
Philippe C. Martin
philippecmartin at sbcglobal.net
Thu Dec 9 12:05:27 EST 2004
Hi,
After all of you answers, I though I had it straight, yet .....
This is what I am doing:
class SC_ISO_7816:
__m_loaded = None
......
def __init__(self):
"""
"""
if SC_ISO_7816.__m_loaded == None:
SC_ISO_7816.__m_loaded = True
print 'LOADING'
self.__Load()
print self.SW1_DICT
else:
print 'DICT ALREADY LOADED!',
print self.SW1_DICT
pass
.......
if I import and/or create more than one instance of SC_ISO_7816, when I see
'LOADING' then I also see a fully populated dictionary.
But when I see (second or more time)
'DICT ALREADY LOADED', then my dict is emtpy
What else am I not understanding ?
Regards,
Philippe
--
*********************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
*********************
More information about the Python-list
mailing list