Re: the deceptive continuous assignments

2011-12-06 Thread Chris Angelico
On Wed, Dec 7, 2011 at 9:11 AM, Terry Reedy wrote: > Cute. I am used to linked lists being built from the bottem up in functional > languages with immutable nodes. I might even use something like this. Of > course, for a list of any length, walk needs to be iterative. > >    def walk(self): >    

Re: the deceptive continuous assignments

2011-12-06 Thread Terry Reedy
On 12/6/2011 7:33 AM, Chris Angelico wrote: On Tue, Dec 6, 2011 at 11:20 PM, Terry Reedy wrote: You found an unsafe overlap. x.thing = x = 1 would work, though it seems strange (and unlikely in practice) to rebind x to an int after it is bound to a class k instance. This code is starting to l

Re: the deceptive continuous assignments

2011-12-06 Thread Chris Angelico
On Tue, Dec 6, 2011 at 11:20 PM, Terry Reedy wrote: > You found an unsafe overlap. > x.thing = x = 1 > would work, though it seems strange (and unlikely in practice) to rebind x > to an int after it is bound to a class k instance. This code is starting to look like it wants to work with a linked

Re: the deceptive continuous assignments

2011-12-06 Thread Terry Reedy
On 12/6/2011 6:06 AM, Yingjie Lan wrote: Hi, I just figured out this with Python3.2 IDLE: class k: pass x=k() x.thing = 1 x.thing 1 x = x.thing = 1 Traceback (most recent call last): File "", line 1, in x = x.thing = 1 AttributeError: 'int' object has no attribute 'thing' x 1 =

the deceptive continuous assignments

2011-12-06 Thread Yingjie Lan
Hi, I just figured out this with Python3.2 IDLE: >>> class k: pass >>> x=k() >>> x.thing = 1 >>> x.thing 1 >>> x = x.thing = 1 Traceback (most recent call last):   File "", line 1, in     x = x.thing = 1 AttributeError: 'int' object has no attribute 'thing' >>> x 1 >>> when I do