Re: Problem in designing a global directory in python

2005-03-30 Thread Bruno Desthuilliers
'@'.join([..join(['fred','dixon']),..join(['gmail','com'])]) a écrit : noob warning: what is so wonderful about the NEW class over the old ? A whole lot of things. But the main thing to know is that old-style classes are deprecated, and will disappear in the future. -- http://mail.python.org/mailm

Re: Problem in designing a global directory in python

2005-03-30 Thread Bruno Desthuilliers
Tian a écrit : I googled about how to write singleton in python, but even if I use Singleton, in which module's namespace should I keep the instance of this singleton? You found the doc but I'm afraid you did not grasp the concept. You don't have to 'keep the instance' anywhere - it's the job of t

Re: Problem in designing a global directory in python

2005-03-30 Thread Serge Orlov
Tian wrote: > I have tried using "sysctx=None" instead of "global sysctx", but it > doesn't work either. > It seems my initialization work in the previous calling of init() has > no persistent effect when "utils" is imported using "from > myproj.utils import getContext". > > What's weird, when a mo

Re: Problem in designing a global directory in python

2005-03-29 Thread Terry Reedy
"Tian" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I want to create a object directory called Context in my program, which > is based on a dict to save and retrieve values/objects by string-type I suspect that you would accomplish your goal much more easily by calling your modu

Re: Problem in designing a global directory in python

2005-03-29 Thread '@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])])
noob warning: what is so wonderful about the NEW class over the old ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem in designing a global directory in python

2005-03-29 Thread Tian
I googled about how to write singleton in python, but even if I use Singleton, in which module's namespace should I keep the instance of this singleton? suppose I have a singleton class definiton in "utils.py", how should I import and where should I make instance and initialize? Thanks!! -- http:

Re: Problem in designing a global directory in python

2005-03-29 Thread Bruno Desthuilliers
Tian a écrit : I want to create a object directory called Context in my program, which is based on a dict to save and retrieve values/objects by string-type name. I have the definition like this: utils.py global sysctx class Context: def __init__(self): def set(self, na

Re: Problem in designing a global directory in python

2005-03-29 Thread Tian
I have tried using "sysctx=None" instead of "global sysctx", but it doesn't work either. It seems my initialization work in the previous calling of init() has no persistent effect when "utils" is imported using "from myproj.utils import getContext". What's weird, when a module is in the same direc

Re: Problem in designing a global directory in python

2005-03-29 Thread F. Petitjean
Le 29 Mar 2005 09:50:46 -0800, Tian a écrit : > I want to create a object directory called Context in my program, which > is based on a dict to save and retrieve values/objects by string-type > name. I have the definition like this: > > utils.py > > global sysctx # you are in

Problem in designing a global directory in python

2005-03-29 Thread Tian
I want to create a object directory called Context in my program, which is based on a dict to save and retrieve values/objects by string-type name. I have the definition like this: utils.py global sysctx class Context: def __init__(self): def set(self, name, obj, over