Hi Maarten, On 10 Sep., 13:17, Maarten Derickx <m.derickx.stud...@gmail.com> wrote: > But maybe you could explain why you want to override the __hash__ of > particular instances
It's because I am currently collecting ideas of how to conveniently add a fast hash to existing stuff in Sage. One idea was to add a fast __hash__ directly to the instances. But that seems to be a failing approach. Meanwhile I am more or less able to write a function FastHash, that takes a class as an input and returns "the same" class, but with a Cythonised cached hash. I guess, on the level of instances, self.__class__ = FastHash(self.__class__) might work, and on the level of classes, FastHash may be a metaclass. But I have to learn about metaclasses first. Best regards, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org