jimgardener a écrit :
> hi Steven,
> can you explain that?I didn't quite get it.
> I have a module say 'managerutils' where I have a class
> MyManager..
What Steven was talking about was to NOT use a class at all. Modules are
objects and have their own namespace. And you can use threading.locals
i
thanks Arnold..that made it quite clear
harry
On Oct 3, 4:11 pm, Arnaud Delobelle wrote:
> Arnaud Delobelle writes:
>
--
http://mail.python.org/mailman/listinfo/python-list
Arnaud Delobelle writes:
[...]
> That's because overriding __new__ doesn't prevent __init__ from being
> executed. The reason for this is that when you do:
>
> MySingle('jeff')
>
> what is executed is:
>
> MySingle.__metaclass__.__call__('jeff')
Oops. I meant:
MySingle.__metaclass_
harryos writes:
> hi
> I have been trying out singleton design pattern implementations..I
> wrote this,
>
>
> class Singleton(object):
> _instance = None
> def __new__(self, *args, **kwargs):
> if not self._instance:
> self._instance = super(Singleton, self).__new__(se
hi Steven,
can you explain that?I didn't quite get it.
I have a module say 'managerutils' where I have a class
MyManager..
ie,
managerutils.py
--
class MyManager(object):
def __init__(self):
self.myaddresses={}
...
from another main program ,if I call ,
import managerutils
thanks Steven..that was very helpful..thanks a lot
harry
> Since __new__ is called before the instance exists, it doesn't receive an
> instance as the first argument. Instead it receives the class. While you
> can call the parameter anything you like, it is conventional to call it
> cls rather than
On Sun, 03 Oct 2010 01:55:00 -0700, harryos wrote:
> hi
> I have been trying out singleton design pattern implementations..I wrote
> this,
>
>
> class Singleton(object):
> _instance = None
> def __new__(self, *args, **kwargs):
> if not self._instance:
> self._instance
hi
I have been trying out singleton design pattern implementations..I
wrote this,
class Singleton(object):
_instance = None
def __new__(self, *args, **kwargs):
if not self._instance:
self._instance = super(Singleton, self).__new__(self,
*args, **kwargs)
return