Hi Nils, On 2014-12-01, Nils Bruin <nbr...@sfu.ca> wrote: > I don't think it's a memory *leaking* issue this time.
Good tidings :) > They are not using POSets as parents--they are using them as elements. Aha! That's interesting. I think I have discussed it with Nicolas at some point. In fact, it seems that the whole parent-element-category stuff is not designed for a situation where you have parent structures that at the same time serve as elements of another parent structure. For starters, element_class and parent_class give rise to confusion if a parent is supposed to inherit from both. Anyway, elements shouldn't be "unique representation", except when there are only few elements (as in small finite fields). In principle, it is possible to work around the cache. For example, if Foo is a parent structure that in *some* (not all) applications should be used as an element and thus shouldn't be cached, one could implement some `__classcall__` or `__classcall_private__` that takes an optional argument "cache=True" (that should be the default, I guess), so that the cached `__classcall__` of UniqueRepresentation is not called when cache=False. Mind, though, that it would still inherit comparison by identity. So, it should perhaps better use CachedRepresentation, not UniqueRepresentation (the former does *not* do comparison by identity). Hmm. Sounds like a mess. But I do think one should have a general mechanism ("UniqueRepresentationOptional" or so) with which one can choose by an optional argument whether caching and comparison by identity should be used or not. >> In any case, it is possible to explicitly clear the cache of a >> UniqueRepresentation. But this would only help if there is a strong >> reference >> pointing from the dictionary key to the corresponding item. >> > > Yes it is possible but it should absolutely not be recommended! Right, sorry, I forgot about the side effects. Cheers, Simon -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.