On 08/12/2012 17:48, Josh English wrote:
On Saturday, December 8, 2012 9:40:07 AM UTC-8, Peter Otten wrote:
Two underscores trigger name mangling only in a class, not in a module.
Don't try to hide the Options instance:
# module config.py
import ConfigParser
class Options(ConfigParser.SafeC
On Saturday, December 8, 2012 9:40:07 AM UTC-8, Peter Otten wrote:
>
>
>
> Two underscores trigger name mangling only in a class, not in a module.
>
> Don't try to hide the Options instance:
>
>
>
> # module config.py
>
> import ConfigParser
>
>
>
> class Options(ConfigParser.SafeConfig
Josh English wrote:
> I have seen older posts in this group that talk about using modules as
singletons, but this, unless I misunderstand, requires me to code the entire
API for SafeConfigParser in the module:
>
>
> import ConfigParser
>
>
> class Options(ConfigParser.SafeConfigParser):
>
I am trying to create a Singleton SafeConfigParser object to use across all the
various scripts in this application.
I tried a Singleton pattern found on the web:
class Singleton(object):
def __new__(cls):
if not hasattr(cls, '_inst'):
print "Creating Singleton Object"