On Monday, 9 August 2021 at 19:43:29 UTC-7 Lorenz Panny wrote: > Have we considered the idea to simply call self.set_immutable() whenever > __hash__ is invoked? I think that would solve Nils' original problem
It would solve my problem and it would avoid a whole bunch of problems we'd have with implementation of "parallel" default mutable/default immutable parents, since they'd mess up the coercion graph considerably. I suspect it could lead to rather nightmarish debugging scenarios where someone really thought they had a mutable vector and now have to track down which operation lost the problem. Especially in the "easier to ask forgiveness" programming paradigm that is common in Python I'd imagine caching code might work something like this: try: h = hash(v) except TypeError: h = hash(tuple(v)) and that would have perhaps surprising results with the proposal. I like it, though. It's a really lightweight solution. A little hackish, though. But very practical. -- 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/5012d173-5287-45a0-95aa-2a31020d25a8n%40googlegroups.com.