2.3 list reverse() bug?
Robin Becker
robin at jessikat.fsnet.co.uk
Thu Dec 25 06:18:39 EST 2003
More information about the Python-list mailing list
Thu Dec 25 06:18:39 EST 2003
- Previous message (by thread): 2.3 list reverse() bug?
- Next message (by thread): 2.3 list reverse() bug?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <d3c9c04.0312250303.561b119d at posting.google.com>, Mark Carter <cartermark46 at ukmail.com> writes >I did this: > >Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on >win32 > >>>> d1 = [1,2] >>>> d2 = d1 >>>> d2.reverse() >>>> print d1 #note: d1, not d2 >[2, 1] >>>> > >Surely that can't be right: d1 should still be [1,2]. If it is >"right", then I expect that many people are in for a suprise. Really need to get a life, but anyhow here goes. It's right. d1 & d2 both point to the same mutable object and sort is done in place. compare with this >>> d1=[1,2] >>> d2=d1 >>> d2[0]='a' >>> d1['a', 2] >>> -- Robin Becker
- Previous message (by thread): 2.3 list reverse() bug?
- Next message (by thread): 2.3 list reverse() bug?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list