#11943: The category graph should comply with Python's method resolution order
---------------------------+------------------------------------------------
Reporter: SimonKing | Owner: nthiery
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.8
Component: categories | Keywords: category graph, method resolution
order
Work_issues: | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #11900
---------------------------+------------------------------------------------
Comment(by mderickx):
That is indeed my suggestion. But my specific implementation would be:
{{{
#!python
def is_subcategory(self, C):
hook_result = C.subcategory_hook(self)
if hook_result is not NotImplemented:
return hook_result
return C in self._set_of_super_categories
}}}
So that it is more similar to the !__subclasshook!__ that python provides
and your shortcut can just return NotImplemented to signify that the
shortcut didn't work (just like you can do with the subclasshook). And
make a default implementation in Category that just returns
NotImplemented. The new magical method should indeed be documented.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11943#comment:31>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.