#12601: @cached_method does not work for special methods
-------------------------------------------------+-------------------------
Reporter: saraedum | Owner: jason
Type: enhancement | Status:
Priority: minor | needs_review
Component: misc | Milestone: sage-5.13
Keywords: cached_method, cache, | Resolution:
operator, special method | Merged in:
Authors: Simon King | Reviewers:
Report Upstream: Completely fixed; Fix | Work issues:
reported upstream | Commit:
Branch: | Stopgaps:
Dependencies: #15038 |
-------------------------------------------------+-------------------------
Comment (by nbruin):
In an attempt to be a little systematic in extracting a complete list of
methods that get stored in slots on a type object (those are the methods
that need special attention, right?), I used
{{{
grep 'SLOT(".*"' Objects/typeobject.c
}}}
to extract the relevant lines from the definition of `slotdefs` in the
python source. When processed, I obtain the list:
{{{
['__abs__', '__add__', '__and__', '__call__', '__cmp__', '__coerce__',
'__contains__', '__del__', '__delattr__', '__delete__', '__delitem__',
'__delslice__', '__div__', '__eq__', '__float__', '__floordiv__',
'__ge__', '__get__', '__getattr__', '__getattribute__', '__getitem__',
'__getslice__', '__gt__', '__hash__', '__hex__', '__iadd__', '__iand__',
'__idiv__', '__ifloordiv__', '__ilshift__', '__imod__', '__imul__',
'__index__', '__init__', '__int__', '__invert__', '__ior__', '__ipow__',
'__irshift__', '__isub__', '__iter__', '__itruediv__', '__ixor__',
'__le__', '__len__', '__long__', '__lshift__', '__lt__', '__mod__',
'__mul__', '__ne__', '__neg__', '__new__', '__nonzero__', '__oct__',
'__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdiv__',
'__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__',
'__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__',
'__rtruediv__', '__rxor__', '__set__', '__setattr__', '__setitem__',
'__setslice__', '__str__', '__sub__', '__truediv__', '__xor__', 'next']
}}}
Hopefully this list is complete. Is there another source of such methods?
I noticed that there is a non-underscored method in there as well: `next`
(this got fixed in Python 3). Admittedly, one should probably never cache
that, but it's not the job of the decorator to enforce that.
--
Ticket URL: <http://trac.sagemath.org/ticket/12601#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.