#20902: Move Parent.list() method to Sets category
-------------------------+-------------------------------------------------
       Reporter:  klee   |        Owner:
           Type:         |       Status:  needs_review
  defect                 |
       Priority:  major  |    Milestone:  sage-7.3
      Component:         |   Resolution:
  categories             |
       Keywords:         |    Merged in:
        Authors:         |    Reviewers:
  Kwankyu Lee            |
Report Upstream:  N/A    |  Work issues:
         Branch:         |       Commit:
  u/klee/20902           |  6a36fa0c3c2c058c9dfb9dff74719174838c1a04
   Dependencies:         |     Stopgaps:
-------------------------+-------------------------------------------------

Comment (by klee):

 First let me thank you for raising these issues, which are legitimate.

 > * You are arguing that these functions **should** be in
 `EnumeratedSets`, but you move them to `Sets`. Why not move them to
 `EnumeratedSets` and start adding parents to that category? At least, you
 should keep the TODO that this would be best?

 Many parents in Sage do have `list` method, but are not declared as in
 enumerable set category. Some of them seems that their enumerability is
 determined only at runtime, so cannot be declared so in its defining
 class. For example, a free module over a ring can be either enumerable or
 not depending on the ring. So keeping the "list" method only in
 `EnumeratedSets` category is not the way to support `list` method for
 existing parents. For the reason, I doubt that the TODO is really what we
 have to do. Yes, I am arguing against myself, but the **should** is for a
 perfect world.

 > * The `list` function now returns a copy of the (cached) list every
 time. We had a long discussion on sage-devel as well as on #20743 about
 this, and though complete consensus didn't arise, everyone seemed to think
 that `list` should **not** return a fresh copy every time. Rather we
 should somehow flag the list as being immutable.

 I am aware of the discussion. I was one of the proponents that `list`
 method should return a cashed tuple rather than a list. But searching
 through Sage library, I find that (1) `list` method is inconsistently
 implemented for many parents in Sage; (2) The implementation of `list`
 method for finite sets category returns a fresh copy of a cached list each
 time  (the same is true for `list` method of the current `Parent` class).
 My conclusion is that the behavior of the `list` method of the parents in
 the finite sets category is the de facto standard in Sage. So I copied the
 "standard" implementation to `Sets` category.

 In the present ticket, I am not taking any position  about how the `list`
 method should be implemented, but just move around what is already in
 Sage. If we all agree on a proper implementation of the `list` methods of
 parents in the category framework, that should be another ticket.  Let me
 just say that for this issue, my present opinion is that the current
 implementation is reasonable in the category framework, and if a specific
 parent needs better performance, it can just implement its own `list`
 method.

--
Ticket URL: <https://trac.sagemath.org/ticket/20902#comment:7>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to