RE: Singleton Class Exception

2006-11-13 Thread Ames Andreas
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > g] On Behalf Of Dan Lenski > Sent: Monday, November 13, 2006 7:05 PM > Subject: Re: Singleton Class Exception > > dischdennis wrote: > > the line "raise Singleton.__single&qu

Re: Singleton Class Exception

2006-11-13 Thread Jason
I threw together two different singleton classes. They both ensure that the initializers and destructors can be called at most once. (The ImmortalSingleton won't ever have its destructor called unless the programmer manually forces things.) I haven't extensively tested these things, so handle th

Re: Singleton Class Exception

2006-11-13 Thread Dan Lenski
dischdennis wrote: > the line "raise Singleton.__single" invokes in my class the following > error: > > exceptions must be classes, instances, or strings (deprecated), not > PurchaseRequisitionController Denis, Jason's explanation is correct! You are trying to use the Singleton instance as the ex

Re: Singleton Class Exception

2006-11-13 Thread Jason
dischdennis wrote: > Hello List, > > I would like to make a singleton class in python 2.4.3, I found this > pattern in the web: > > class Singleton: > __single = None > def __init__( self ): > if Singleton.__single: > raise Singleton.__single > Singleton.__single

Singleton Class Exception

2006-11-13 Thread dischdennis
Hello List, I would like to make a singleton class in python 2.4.3, I found this pattern in the web: class Singleton: __single = None def __init__( self ): if Singleton.__single: raise Singleton.__single Singleton.__single = self the line "raise Singleton.__s