me: I would like to use a linear positional indexed data structure as a key in a map
python: sure, use a tuple
@aparrish p sure anything you use as an object key gets stringified anyway
@aparrish ahhh, sorry, I just associated map->hash->object in my head; didn't realise it was an actual thing now
@aparrish I mean, IIRC python is comparing by serializing to string implicitly anyway (running class __repr__ method). Are you annoyed that it'd be slow, or that it would need to be written?
@enkiv2 No, it uses __hash__ and __eq__, see https://docs.python.org/3/glossary.html#term-hashable
@enkiv2 I'm just annoyed that there doesn't appear to be an explicit way to do this, and I'm left to invent my own protocol. also python dictionary keys use the value from __hash__ not __repr__, don't they? (which doesn't have to be implemented as string serialization, in fact I'm pretty sure it isn't in the case of tuples)
@air_hadoken oh this is cool, thanks!
@aparrish fool that I am, I thought you were joking about the charts
@aparrish oh god, the equality semantics are defined by "ALGORITHMS."
This sounds like one of those up-front refusals to fix the semantics bugs no matter what the problem turns out to be.
Which I suppose is par for the course.
Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!