In article <[EMAIL PROTECTED]>,
Craig Allen <[EMAIL PROTECTED]> wrote:
>
>(option 2)
>Therefore option two is a family of options where class level members
>can be used to share whatever needs to be shared, though strictly the
>class is not a singleton since multiple instances are created which
>m
On Jul 17, 9:04 pm, Paddy <[EMAIL PROTECTED]> wrote:
> On Jul 16, 11:20 pm, Craig Allen <[EMAIL PROTECTED]> wrote:
>
> > Hey, forgive me for just diving in, but I have a question I was
> > thinking of asking on another list but it really is a general question
> > so let me ask it here. It's about
On Jul 16, 11:20 pm, Craig Allen <[EMAIL PROTECTED]> wrote:
> Hey, forgive me for just diving in, but I have a question I was
> thinking of asking on another list but it really is a general question
> so let me ask it here. It's about how to approach making singletons.
Hi Craig,
This might be goo
In message
<[EMAIL PROTECTED]>, Craig
Allen wrote:
> On Jul 16, 7:01 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED]
> central.gen.new_zealand> wrote:
>>
>> >>> class TehLibrary(object) :
>>
>> ... @classmethod
>> ... def __new__(self, cls) :
>> ... return self
>>
>> >>> s = TehLibrary(
On Jul 17, 2:15 am, Uwe Schmitt <[EMAIL PROTECTED]>
wrote:
> On 17 Jul., 00:20, Craig Allen <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have several classes in our system which need to act like
> > singletons, they are libraries of data classifications, and other such
> > libraries of configurations for
On 17 Jul., 00:20, Craig Allen <[EMAIL PROTECTED]> wrote:
>
> I have several classes in our system which need to act like
> singletons, they are libraries of data classifications, and other such
> libraries of configurations for the system which need to be global.
> ...
>
> Is it pythonic?
My appr
On Jul 16, 7:01 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED]
central.gen.new_zealand> wrote:
> In message
> <[EMAIL PROTECTED]>, Craig
>
> Allen wrote:
> > ... the ideal is still that
>
> > tl = TehLibrary() would always return the same object.
> >> class TehLibrary(object) :
>
> ... @classmethod
On Jul 16, 6:20 pm, Craig Allen <[EMAIL PROTECTED]> wrote:
> Anyone have any comments? Is there anything wrong, evil, or ugly
> about using a module this way, or am I correct to think that actually,
> this is a common approach in python.
>
> Is it pythonic?
The one drawback to this is that it co
In message
<[EMAIL PROTECTED]>, Craig
Allen wrote:
> ... the ideal is still that
>
> tl = TehLibrary() would always return the same object.
>> class TehLibrary(object) :
... @classmethod
... def __new__(self, cls) :
... return self
>>> s = TehLibrary()
>>> s == TehLibrary()
True
On Jul 17, 8:20 am, Craig Allen <[EMAIL PROTECTED]> wrote:
> Is it pythonic?
You probably can't get anymore pythonic than something written by the
BDFL. In describing the use of __new__ in Unifying types and
classes in Python 2.2 he gives this recipe for a Singleton.
class Singleton(object):
I don't intend to do much subclassing of this, but of course, I'd
rather not second guess the future and it's not hard to imagine we
will come to some point that we need to do just that. Thanks for the
ideas about repairing option one, which I'd given up, though the ideal
is still that
tl = TehLi
On Jul 16, 5:20 pm, Craig Allen <[EMAIL PROTECTED]> wrote:
> Hey, forgive me for just diving in, but I have a question I was
> thinking of asking on another list but it really is a general question
> so let me ask it here. It's about how to approach making singletons.
> Background: I've been progr
12 matches
Mail list logo