Hi Simon,

> just for clarification: What you are reporting is the behaviour or
> unpatched Sage, i.e., it is not caused by my patches from #11115,
> correct?

Sorry, for my unprecise bug report. I indeed had the problem with unpatched
sage 4.6.2.

> But my patches do not solve the problem either -- only the error
> message for b is different:
> sage: b = B()
> sage: b.toto()
> 3
> sage: b.toto()
> Traceback (most recent call last):
> ...
> TypeError: toto() takes exactly 2 arguments (1 given)
> 
> I can explain that example: If you call b.toto() the first time, then
> the cached method defined in class A is called.
> One of the things a cached method does with my patch is to replace
> itself by a CachedMethodCaller (without the patch, the
> CachedMethodCaller would be constructed over and over again, which is
> a waste of time and may break the cache).
> Hence, if you call b.toto() the second time, it becomes a different
> method, expecting different arguments (the default argument is gone).

Yes ! That's what I figured out.

> I have some ideas how this could be solved: When A.toto is called from
> an instance b, it should test whether b.toto is actually defined in A
> or overridden in a subclass (so that it is either called directly or
> using "super"). If it is overridden, then it must not try to assign
> the CachedMethodCaller as an attribute to b. I'll try to implement it
> and update my patches at #11115.

Cool ! I'll follow it to help the review.

Cheers,

Florent

-- 
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

Reply via email to