dbr/tvdb_api — pull request #43 by dougalsutherland (2014-03-31 05:36:37+00:00)
Title: fix ShowContainer cache resizing

The old code would end up doing effectively `del self._stack[0]; del self._stack[1]; del self._stack[2]` and so on. This isn't what was intended, since after `del self._stack[0]` the thing that was previously 1 is now 0. This meant that the cache was being cleared incorrectly, and if there were a lot of things in the cache between GCs then you could get an `IndexError`. It also moves the entire list around in memory over and over.

Instead, we can just assign the variable to a sublist of the old one, which takes one memory copy instead of `len(self._stack) - 100`.