Memoization and encapsulation

Tom Anderson twic at
Wed Jan 4 15:29:42 EST 2006

On Wed, 4 Jan 2006 drewp at wrote:

> I think python is broken here-- why aren't lists hashable, or why isn't
> there a straightforward way to make memoised() work?

a = [1, 2, 3]
d = {a: "foo"}
a[0] = 0
print d[a]

I feel your pain, but i don't think lists (and mutable objects generally) 
being unhashable is brokenness. I do think there's room for a range of 
opinion, though, and i'm not sure what i think is right.


Rapid oxidation is the new black. -- some Mike

More information about the Python-list mailing list