Re: Singleton implementation problems

2008-07-05 Thread Urizev
Great! Thanks everyone for so many references and comments. Lots of doubts have been solved. On Fri, Jul 4, 2008 at 10:33 AM, Peter Otten <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > >> Peter Otten <[EMAIL PROTECTED]> writes: >> >>> The problem is the structure of your program. The myset modul

Re: Singleton implementation problems

2008-07-04 Thread Terry Reedy
Ben Finney wrote: Peter Otten <[EMAIL PROTECTED]> writes: The problem is the structure of your program. The myset module is imported twice by Python, once as "myset" and once as "__main__". Yes, this is the problem. Each module imports the other. Therefore you get two distinct MySet class

Re: Singleton implementation problems

2008-07-04 Thread Peter Otten
Ben Finney wrote: > Peter Otten <[EMAIL PROTECTED]> writes: > >> The problem is the structure of your program. The myset module is >> imported twice by Python, once as "myset" and once as "__main__". > > Yes, this is the problem. Each module imports the other. > >> Therefore you get two distinc

Re: Singleton implementation problems

2008-07-04 Thread Matthew Fitzgibbons
Ben Finney wrote: Peter Otten <[EMAIL PROTECTED]> writes: The problem is the structure of your program. The myset module is imported twice by Python, once as "myset" and once as "__main__". Yes, this is the problem. Each module imports the other. Therefore you get two distinct MySet classes

Re: Singleton implementation problems

2008-07-04 Thread Ben Finney
Peter Otten <[EMAIL PROTECTED]> writes: > The problem is the structure of your program. The myset module is > imported twice by Python, once as "myset" and once as "__main__". Yes, this is the problem. Each module imports the other. > Therefore you get two distinct MySet classes, and consequentl

Re: Singleton implementation problems

2008-07-03 Thread Peter Otten
Urizev wrote: > Hi everyone > > I have developed the singleton implementation. However I have found a > strange behaviour when using from different files. The code is > attached. > > Executing main > New singleton: > <__main__.Singleton instance at 0x2b98be474a70> > New singleton: > > I do n

Re: Singleton implementation problems

2008-07-03 Thread George Sakkis
On Jul 3, 6:58 pm, Urizev <[EMAIL PROTECTED]> wrote: > Hi everyone > > I have developed the singleton implementation. However I have found a > strange behaviour when using from different files. The code is > attached. > > Executing main > new MySet object > No singleton instance > New singleton: >

Re: Singleton implementation problems

2008-07-03 Thread Matthew Fitzgibbons
Urizev wrote: Hi everyone I have developed the singleton implementation. However I have found a strange behaviour when using from different files. The code is attached. Executing main new MySet object No singleton instance New singleton: <__main__.Singleton instance at 0x2b98be474a70> new MySet

Singleton implementation problems

2008-07-03 Thread Urizev
Hi everyone I have developed the singleton implementation. However I have found a strange behaviour when using from different files. The code is attached. Executing main new MySet object No singleton instance New singleton: <__main__.Singleton instance at 0x2b98be474a70> new MySet object There is