I was being stupid and pretended to clear the cache by hand *facepalm*.
I can confirm that doing things properly everything works as expected.
Sorry about the noise
S.
* Nils Bruin <nbr...@sfu.ca> [2019-01-08 08:47:54]:
On Tuesday, January 8, 2019 at 6:21:39 AM UTC-8, Salvatore Stella wrote:
Dear all,
sorry for disappearing on this. I am a little confused: if both parent and
element refer to the same cache how is it possible that clearing one does
not
clear the other?
S.
If you have
D={1:1}
A=D
B=D
You have two references to the same dictionary. Executing
A.clear()
will lead to B pointing to an empty dictionary (the same one A is pointing
to). If however you do
A={}
then A will be pointing to a fresh empty dict and B will still be pointing
to the original dictionary, which is not empty.
Is that perhaps how you were trying to clear the cache?
As far as I can see, calling clear on the one reference of the cache also
ensures that the other reference points to an empty cache.
--
Incidentally, I found an error in sage/misc/cachefunc.pyx:3286.
try:
P = inst.parent()
return P.__dict__.setdefault(self._cache_name, default)
except AttributeError:
pass
if not hasattr(P,'__cached_methods'):
If "P=inst.parent()" fails with an AttributeError then this gets silence
and the "hasattr" fails due to P not having been assigned. I think the
initialization of P should be moved out of the try block. It's the lookup
of P.__dict__ that should be silenced, not the initialization of P.
--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.