On Tuesday, 10 August 2021 at 09:46:44 UTC-7 Matthias Koeppe wrote: > On Monday, August 9, 2021 at 7:43:29 PM UTC-7 Lorenz Panny wrote: > >> Have we considered the idea to simply call self.set_immutable() whenever >> __hash__ is invoked? >> > > -1 on this; too complicated semantics > The semantics are actually quite straightforward: it's hashability-on-demand. It makes the system as permissible as is possible while staying consistent. One would really have no business asking the hash of a structure that is supposed to be mutable, and I expect that there is very little code out there that would be hit by this (because, really, one has to be rather purposeful in sage to actually mutate a vector. You really end up using it in a rather non-mathematical way.
The only concern would be these accidental "try hash(v) except TypeError" scenarios, but I don't know if those actually occur in the sage library. It would be interesting to see how much of the library breaks if we put this in place. I suspect it might be very little. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/7e0e318a-3e03-40a3-b852-eb40e70a2d25n%40googlegroups.com.