News for hackers. Stuff that matters.
Re:Python Lists vs. Tuples by catnaroek on Friday August 19, 2016 @10:20PM (#12324799)
So, which is the case?

(0) Object identities are used as keys? (e.g., two different list objects that contain the elements 1,2,3 are treated as different keys)

(1) Catastr... I mean, hilarious things happen if you mutate an object that's being used as a key?

Re:Python Lists vs. Tuples by kilink on Friday August 19, 2016 @10:40PM (#12324888)
I'm not sure if you are asking about Python, or Ruby.

Anyway, both languages use value-based hashing for dictionaries. I am not a Rubyist, but I guess you are just expected to not mutate the keys? Ruby's dictionary implementation also has a rehash method to deal with this case [1], if for some reason you are purposely mutating the keys I suppose...

[1] http://docs.ruby-lang.org/en/2.0.0/Hash.html#method-i-rehash

Re:Python Lists vs. Tuples by catnaroek on Friday August 19, 2016 @10:56PM (#12324948)
> I'm not sure if you are asking about Python, or Ruby.

Ruby, since you said it allows mutable keys in dictionaries.

> Anyway, both languages use value-based hashing for dictionaries.

Neither Python nor Ruby has compound values. Object identities are primitive values.

> but I guess you are just expected to not mutate the keys?

I guess C programmers are expected not to use memory after they free it.