« first day (4945 days earlier)   

3:58 PM
Hmm, I just learned that ArrayLists can be hashmap keys in Java. That feels like a quite extraordinary degree of freedom to be handing the programmer... and then I find you can do it in C++ as well, but that's never cared about its arsenal of footguns; is Python somewhat odd in forcing immutability?
 
According to this answer, it's not a footgun. It's a footarsenal!
 
I wanna see what Rust does now. I'm thinking you only need to define the Hash trait and the relevant methods on any arbitrary struct. I'd never thought anything about it because it's just in my brain that only immutable things could be hashed but that obviously needn't be true now that I think. That would potentially be one hell of a memory leak
 
Technically, Python also hashes all sorts of mutable things as long as their value is not used for comparison.
You can use generators as dict keys, for example.
 
@roganjosh I think we need a PEP to bring Python inline with other languages: add __hash__ = lambda self: id(self) to object :)
 
Too right; I demand the right to sabotage myself in new and exciting ways!
 
4:09 PM
@Peilonrayz that's already the case
 
@MisterMiyagi Huh, you're right.
 

« first day (4945 days earlier)