> Faster is:
>
>class FastHashableList(list):
> def __hash__(self):
> return id(self)
But that's wrong. Two equal objects must hash to the same value, and
you're not guaranteeing that at all. My degenerate __hash__ does
guarantee that, and I still claim the performance impact from
collision
But while we're at it, how about that unhashable object problem?
@memoised
def func(x, i):
return x[i]
L = [1,2,3]
print func(L, 1) # TypeError: list objects are unhashable
What's the deal? My func can certainly be memoized (but possibly with a
slower lookup depending on how many args are
Esmail Bonakdarian wrote:
>
> Basically, I would like to be able to create some basic animations
> where I can help visualize various sorting algorithms (for instance
>
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/sorting.html#insert_anim)
> or graph searches (coloring nodes as each gets visit