
June 25, 2009
9 a.m.
Kristján Valur Jónsson <krist...@ccpgames.com> wrote:
The idea is to speed up the swapping of list elemenst so that a.swap(b) is equivalent to a[:], b[:] = b[:], a[:] but without all the overhead of creating slices, assigning them and so forth.
I think I'd use a mapping to hold the lists so I could do a straight re-assignment: d['a'], d['b'] = d['b'], d['a'] Of course, all references to the lists would have to be brokered through the mapping object, but I tend to find it easier to do so anyway.