#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.7.3
Component: categories | Keywords: category graph, method resolution
order
Work_issues: | Upstream: N/A
Reviewer: | Author: Simon King
Merged: | Dependencies: #11900
---------------------------+------------------------------------------------
Changes (by SimonKing):
* status: needs_review => needs_work
Comment:
There is a new suggestion, also based on the
[http://groups.google.com/group/sage-
devel/browse_thread/thread/ab03a0d422810e73 sage-devel thread]:
If we want to test whether a category C is a super category of a category
D, then we currently try to find C in the ''list'' of all super
categories. But it is much faster to search it in a ''frozen set'' of
super categories.
So, I suggest to use a lazy attribute `_set_of_super_categories`,
providing the frozen set. It will be used in `is_subcategory`. Of course,
the ''list'' of super categories should still be available, and its order
should comply with Python's mro, according to the subject of this ticket.
Since #11115 is merged into sage-4.7.3.alpha1, I wonder whether it is
still necessary to have the list of all super categories as a lazy
attribute, or whether a cached method is fast enough. I'll need some
tests.
However, I think it is a good idea to have a lazy attribute
`_super_categories`. In that way, we have the speed even if the user does
not use @cached_method when (s)he implements the method
`super_categories()`.
"Needs work", until I have sorted it out.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11943#comment:14>
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.