Re: [BangPypers] Nice "feature"

2011-04-01 Thread Senthil Kumaran
On Fri, Apr 01, 2011 at 07:31:56PM +0530, Noufal Ibrahim wrote: > Would anyone here characterise this as a bug? http://bugs.python.org/issue11562 -- Senthil ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/ban

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Noufal Ibrahim
On Fri, Apr 01 2011, Ruchir Shukla wrote: > Hello, > > This is just because you are changing the value of b and in foo there is a > reference of b. > > while in foo = (1,[2,3,4]) foo[1] += [6] > Traceback (most recent call last): > File "", line 1, in > TypeError: 'tuple' object does n

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Noufal Ibrahim
On Fri, Apr 01 2011, Roshan Mathews wrote: > On Fri, Apr 1, 2011 at 18:44, Hussain Bohra wrote: >> Atleast on changing list, you gets an exception. >> >> On updating dictionary living inside tuple wont throw an exception as well. >> > I thought the surprising part was that it threw an exception,

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Shekhar Tiwatne
On Friday 01 April 2011 06:51 PM, Roshan Mathews wrote: On Fri, Apr 1, 2011 at 18:25, Navin Kabra wrote: With Python 2.6.5 (on ubuntu) I get even more bizarre behavior: foo=(1,[2,3,4]) foo[1]+=6 foo[1]+6 won't work anyways l = [2,3,4] l+=6 # same error foo[1] += [6] # treated as tuple o

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Ruchir Shukla
Hello, This is just because you are changing the value of b and in foo there is a reference of b. while in >>> foo = (1,[2,3,4]) >>> foo[1] += [6] Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not support item assignment >>> foo (1, [2, 3, 4, 6]) >>> it i

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Noufal Ibrahim
On Fri, Apr 01 2011, Navin Kabra wrote: > With Python 2.6.5 (on ubuntu) I get even more bizarre behavior: foo=(1,[2,3,4]) foo[1]+=6 Use [6] rather than 6. > Traceback (most recent call last): > File "", line 1, in > TypeError: 'int' object is not iterable foo > (1, [8, 9, 10])

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Noufal Ibrahim
On Fri, Apr 01 2011, Baishampayan Ghose wrote: [...] foo = (1, [2, 3, 4]) foo[1].append(5) foo > (1, [2, 3, 4, 5]) foo[1].append(6) foo > (1, [2, 3, 4, 5, 6]) This is an inplace modification. Does the other one "change" the list in some sense that the tuple gets annoyed

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Roshan Mathews
On Fri, Apr 1, 2011 at 18:44, Hussain Bohra wrote: > Atleast on changing list, you gets an exception. > > On updating dictionary living inside tuple wont throw an exception as well. > I thought the surprising part was that it threw an exception, not that it updated the list. Even more surprising

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Roshan Mathews
On Fri, Apr 1, 2011 at 18:25, Navin Kabra wrote: > With Python 2.6.5 (on ubuntu) I get even more bizarre behavior: foo=(1,[2,3,4]) foo[1]+=6 > Traceback (most recent call last): >  File "", line 1, in > TypeError: 'int' object is not iterable foo > (1, [8, 9, 10]) > Couldn't reprod

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Hussain Bohra
>>> Both python 2.6 and 3.1 behaves in the same way.   Thanks and Regards, Hussain Bohra Tavant Technologies, Bangalore-95 mail-to:hussain.bo...@tavant.com mobile : +91 99867 95727 From: Navin Kabra To: Bangalore Python Users Group - India Sent: Fri, 1

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Baishampayan Ghose
On Fri, Apr 1, 2011 at 6:17 PM, Noufal Ibrahim wrote: > Came across this at PyCon. Comments? > foo = (1,[2,3,4]) foo[1] += [6] > Traceback (most recent call last): >  File "", line 1, in > TypeError: 'tuple' object does not support item assignment foo > (1, [2, 3, 4, 6]) Even nice

Re: [BangPypers] Nice "feature"

2011-04-01 Thread Navin Kabra
With Python 2.6.5 (on ubuntu) I get even more bizarre behavior: >>> foo=(1,[2,3,4]) >>> foo[1]+=6 Traceback (most recent call last): File "", line 1, in TypeError: 'int' object is not iterable >>> foo (1, [8, 9, 10]) On Fri, Apr 1, 2011 at 6:17 PM, Noufal Ibrahim wrote: > > Came across thi

[BangPypers] Nice "feature"

2011-04-01 Thread Noufal Ibrahim
Came across this at PyCon. Comments? >>> foo = (1,[2,3,4]) >>> foo[1] += [6] Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not support item assignment >>> foo (1, [2, 3, 4, 6]) >>> -- ___ BangPypers mailing