Tim Peters <t...@python.org> added the comment:
What, exactly, in the output shows "the problem"? When I run it, the `a == b` part is always True, while `len(x)` and `len(crazyQuilt2)` are always 30. The other three (len(coordinates), len(x2), len(x3)) are always equal to each other, but are monotonically non-increasing across output lines. For example, a typical block of output lines: (True, 30, 30, 30, 30, 30) (True, 30, 30, 30, 30, 30) (True, 30, 30, 30, 30, 30) (True, 30, 30, 30, 30, 30) (True, 19, 30, 30, 19, 19) (True, 19, 30, 30, 19, 19) (True, 19, 30, 30, 19, 19) (True, 12, 30, 30, 12, 12) (True, 12, 30, 30, 12, 12) (True, 12, 30, 30, 12, 12) None of that surprises me. Exactly what about it surprises you? Or do you get different kinds of output (and, if so, exactly what?)? Here's my guess: you _intended_ these two lines: crazyQuilt2[coordinate2Index] = crazyQuilt2[index] crazyQuilt2[index] = crazyQuilt2[coordinate2Index] to _swap_ the values at indices `index` and `coordinate2Index`. But they don't. They copy the value originally at `index` into the `coordinate2Index` position, and leave the value originally at `index` untouched. As more copies randomly build up, anything that builds a set or dict out of the list naturally gets smaller. ---------- nosy: +tim.peters -zach.ware resolution: not a bug -> stage: resolved -> status: closed -> open _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39338> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com