Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
On 03/26/10 01:10, Rhodri James wrote: Pretty much. In the sense that you're thinking of, every assignment works that way, even the initial "TEST1 = One()". Assignment binds names to objects, though you have to be aware that names can be such exotic things as "t", "a[15]" or "TEST2.__instance_o

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Rhodri James
On Fri, 26 Mar 2010 00:06:06 -, Martin P. Hellwig wrote: On 03/25/10 23:41, Christian Heimes wrote: Martin P. Hellwig schrieb: What I don't understand why in the second test, the last boolean is True instead of (what I expect) False. Could somebody enlighten me please as this has bitt

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
On 03/25/10 23:41, Christian Heimes wrote: Martin P. Hellwig schrieb: What I don't understand why in the second test, the last boolean is True instead of (what I expect) False. Could somebody enlighten me please as this has bitten me before and I am confused by this behavior. Hint: TEST2.one i

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Christian Heimes
Martin P. Hellwig schrieb: > What I don't understand why in the second test, the last boolean is True > instead of (what I expect) False. > Could somebody enlighten me please as this has bitten me before and I am > confused by this behavior. Hint: TEST2.one is not a reference to TEST2.__instance

Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
Hi all, When I run the following snippet (drastically simplified, to just show what I mean): >> import platform, sys class One(object): def __init__(self): self.one = True def change(self): self.one = False class Two(object): def __init__(self): self._inst