hashability
Asun Friere
afriere at yahoo.co.uk
Wed Aug 12 03:13:50 EDT 2009
On Aug 12, 4:52 pm, James Stroud <nospamjstroudmap... at mbi.ucla.edu>
wrote:
> Sorry for being a twit.
Don't be ridiculous. You haven't been a twit, I have!
I've just had a complete "blonde" moment here (with apologies to any
real blondes out there. My only excuse is that I've been up to 02:30
for the last three nights running (or maybe it's the ageing process, a
cerebrovascular accident or something).
I just checked a class I recently wrote specifically for the purposes
of hashing a dict (in case I had made this error IRL). Wouldn't you
know it, it's subclassed to tuple, and defines both __eq__ and
__cmp__. Luckily when I write production code the guy who knows what
he's doing takes over. And this in an app which compares keys from
different pickled files (representing DB holdings)?! Of all things.
I can't believe how unfathomably stupid I've been. I'm extremely
embarassed. I think I'll just go out and shoot myself now. Or get
some sleep.
More information about the Python-list
mailing list