Zachary Ware added the comment: This is not a bug. The assignment "a = nums" doesn't create a copy of "nums", it just assigns the name "a" to the same object that "nums" refers to. Since lists are mutable, changes made to "a" are visible through the name "nums". By the time you do "a[2] = nums[0]", "nums[0]" has been reassigned.
Have a look at this article: http://nedbatchelder.com/text/names.html Also, you may want to look at collections.deque and its rotate method. ---------- nosy: +zach.ware resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22124> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com