TIL: #Python generators and zips are hashable but mutable. The hashcode doesn't include the state (which can be modified by calling next).
>>> z=zip([1, 2, 3], [4, 5, 6])
>>> id(z)4477009472
>>> next(z)(1, 4)
@peterdrake Now that is very interesting!
@peterdrake this is quite interesting. I bet there’s a good story behind this that lead you to discover this
@ellisvalentiner I was just staring at this diagram I drew a while ago and thought, "Wait, how can generators and zips be hashable?"
https://qoto.org/@peterdrake/109255444097688255
CleverLibre Social is an inclusive social instance for open discussion, learning, and community. All cultures welcome. Hate speech and harassment strictly forbidden.
@peterdrake Now that is very interesting!