2.3 list reverse() bug?
Michael Hudson
mwh at python.net
Thu Dec 25 06:42:31 EST 2003
cartermark46 at ukmail.com (Mark Carter) 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.
Try reading this:
http://starship.python.net/crew/mwh/hacks/objectthink.html
Happy Christmas everyone!
Cheers,
mwh
--
Counting lines is probably a good idea if you want to print it out
and are short on paper, but I fail to see the purpose otherwise.
-- Erik Naggum, comp.lang.lisp
More information about the Python-list
mailing list